Compare commits

..

4239 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
Simon Lin 54b31928cf [cli] fix crash when full logs is on (#5408)
It is possible that log is printed before the Interpreter (UART or
CONSOLE) object is created when FULL LOGS is enabled. In such case, OT
crashes. This commit fixes this bug.
2020-08-18 08:43:12 -07:00
Jing Ma 962c06f8e7 [thread-cert] refactor case 5.5.4 using pktverify (#5331) 2020-08-17 22:37:30 -07:00
Jintao Lin 3f38068a71 [mac] change address filter and seek function to accept frame without PAN ID (#5389)
In 802.15.4-2015 spec Table 7-2, it is possible to receive frame with
destination address but without destination PAN ID. This commit
changes the address filter function to avoid dropping such frames.
2020-08-17 22:34:38 -07:00
Michael Spang 5e34b5062d [efr32] switch to proper config #include style (#5409)
Use the config specified on the command line, so that overriding this
with a project specific config doesn't cause preprocessor macro
redefinition errors.
2020-08-16 20:48:21 -07:00
Abtin Keshavarzian 9c8f0951df [udp6] fix 'Udp::Socket::Connect(uint16_t aPort)' (#5407) 2020-08-16 20:37:15 -07:00
Simon Lin 0729138e7b [otns] implement otPlatOtnsStatus for posix (#5357) 2020-08-16 20:36:24 -07:00
kangping 0e11f8bd9b [posix] fix typo in error handling on macOS (#5394) 2020-08-15 16:46:10 -07:00
Abtin Keshavarzian c923dff5c7 [non-copyable] remove empty destructor per style guide (#5401) 2020-08-15 14:38:21 -07:00
Abtin Keshavarzian 78d567a4f6 [mesh-forwarder] add new class 'ThreadLinkInfo' (#5399)
The `ThreadLinkInfo` mirrors the `otThreadLinkInfo` definition.
It is mostly used in `MeshForwarder` and `Mle` class. Here are
some related helper methods:
- New helper methods in `Ip6::MessageInfo` to get and set the
  link info as `ThreadLinkInfo`.
- Helper method `ThreadLinkInfo::SetFrom()` allows it to be set
  from a given `Mac::RxFrame`.
- Helper method `Message::SetLinkInfo()` allows message link info
  related fields (in message metadata) to be set/updated from a
  given `ThreadLinkInfo`.
2020-08-15 13:17:18 -07:00
Simon Lin 02c7c6440a [mle] fix FTD unable to restore link to parent (#5301) 2020-08-15 12:33:14 -07:00
Simon Lin c7cda1feb2 [github-actions] fix otns test failure (#5403) 2020-08-15 10:05:52 -07:00
Simon Lin d7a025cb91 [pretty] shfmt only git files (#5395) 2020-08-14 22:17:45 -07:00
Yakun Xu 8370395c47 [cli] remove multiple servers support (#5387) 2020-08-14 22:15:32 -07:00
Yakun Xu 16a5c52d9f [netdata] add api to check if joiner is in steering data (#5392) 2020-08-14 22:09:14 -07:00
Jing Ma bc195d1329 [thread-cert] refactor case 5.5.2 using pktverify (#5330) 2020-08-14 22:06:01 -07:00
Abtin Keshavarzian 1ad22bac21 [netif] add helper methods to init 'NetifUnicastAddress' (#5390)
This commit adds a group of `Init` methods in `NetifUnciastAddress`
for common initializations of a unicast address with different
parameters (origin, scope, prefix length, and preferred/valid flags).
2020-08-13 22:21:09 -07:00
Abtin Keshavarzian 9481634ccc [mle] use helper method 'Mac::GenerateRandomPanId()' (#5391) 2020-08-13 22:14:25 -07:00
Jing Ma 93243b5f1d [thread-cert] refactor case 5.8.2 and 5.8.3 using pktverify (#5291) 2020-08-12 23:18:33 -07:00
Abtin Keshavarzian 528f8a1208 [neighbor-table] move "neighbor changed callback" and signaling (#5385)
This commit moves the code related to `otNeighborTableCallback`
and signaling `NeighborTable::Event` to `NeighborTable` class
(from `MleRouter`).
2020-08-12 22:18:59 -07:00
Simon Lin 9dbebfc2fe [github-actions] run packet verification for multiple times (#5380)
This commit makes packet verification to run for multiple times.

Since now we are developing many packet verification scripts, this
commit can help us reduce the chance of merging a verification code
that could fail by chance, which is very often for packet verification
code.
2020-08-12 22:15:28 -07:00
Abtin Keshavarzian 1ad2c04bdb [build] add missing header in BUILD.gn (neighbor_table.hpp) (#5386) 2020-08-12 14:50:58 -07:00
Michael Spang a24737a2ad [build] update GN build file for OpenThread (#5358)
Add the CLI & configuration to the build file.
2020-08-12 10:27:52 -07:00
Li Cao 7dc3b2696a [github-action] change the way to upload coverage report (#5375) 2020-08-11 21:30:47 -07:00
Yakun Xu f2d026729d [posix] use raw mode for CLI (#5377)
This commit turns on CLI raw mode on POSIX platform, which is causing
some unstable issues in CI tests.
2020-08-11 13:23:34 -07:00
Jonathan Hui b47dda45cf [test] add test for router reattach with many routers 2020-08-11 13:22:01 -07:00
Jonathan Hui a6865e03e4 [mle] work around MLE Link Accept messages that are too large
This commit addresses an issue where the MLE Link Accept message may
be too large to fit within a single IEEE 802.15.4 frame. Thread
requires any MLE message transported using 6LoWPAN fragmentation to
also enable IEEE 802.15.4 MAC frame security. However, the purpose of
MLE Link Accept messages is to establish a secure link and cannot
itself be transported with IEEE 802.15.4 MAC frame security enabled.

An MLE Link Accept message may carry a Route64 TLV that has a length
dependent on the number of active routers in the network. When there
are many active routers, the Route64 TLV is large and the MLE Link
Accept message can no longer fit within a single IEEE 802.15.4
frame. The side effect is that a router coming out of reset will not
be able to diretly restore its router role and must first attach as an
end device.

This commit limits the size of a Route64 TLV when included in MLE Link
Accept messages. When the number of active routers is above a
threshold, some routers will be elided from the Route64 TLV and the
Router ID Sequence value is decremented. This allows the device coming
out of reset to restore its router role and retrieve the current
Route64 TLV in a subsequent message exchange.
2020-08-11 13:22:01 -07:00
Yakun Xu b5e17e07ee [mle] log handling parent request failures (#5355)
This commit adds a few logs when handling MLE Parent Request, so that
when a child failed to receive a response, the logs can tell what
happened.
2020-08-11 10:22:57 -07:00
Yakun Xu 66dcbac15d [mle] add discovery request callback (#5131)
This commit allows notifying the application a discovery request is
received, which is useful if the application wants to be more active
when a joiner comes.
2020-08-11 10:22:10 -07:00
Yakun Xu 644e0a30f7 [test] only check include/openthread for API version (#5370) 2020-08-11 10:18:25 -07:00
Abtin Keshavarzian 40c7a14b23 [mesh-forwarder] simplify 'FragmentPriorityList' (#5374)
This commit simplifies management of "Fragment Priority Entries"
defining a new class `FragmentPriorityList` with helper method to
allocate/find entries in/from the list. The `Entry` types is also
moved/defined as a nested type of `FragmentPriorityList`.
2020-08-11 10:17:05 -07:00
Zhanglong Xia 9af8fe8cc5 [cli] add cli commands to set unsecure port and link security (#5349) 2020-08-11 09:28:55 -07:00
Simon Lin ecd9436427 [scripts] add packet verification framework (#4428)
This commit introduces the packet verification (PV) framework for
certification tests.

- Add packet verification framework code

- Implement packet verification for cert 5.1.7 as a minimal
  example. There will be more 1.1/1.2 tests with PV submitted in the
  future.

- Download pre-built thread-wireshark binaries from
  openthread/wireshark/releases for packet dissecting (used by
  pyshark)

- Added a Github Action job for Packet Verification
2020-08-11 09:26:28 -07:00
Jonathan Hui 6dddd555e4 [style] clean up lingering NULL -> nullptr (#5373) 2020-08-10 14:28:07 -07:00
Jonathan Hui 376f35a49e [cli] add length check on dataset 'set' command (#5361) 2020-08-10 10:02:11 -07:00
Abtin Keshavarzian 07221dd85c [notifier] simplify how 'Notifier' emits events to core/internal modules (#5365)
This commit changes the way the `Notifier` class emits events to other
OpenThread core/internal modules by having `Notifier` directly invoke
their callbacks, i.e., `Notifier::EmitEvents()` uses a hard-coded list
of all core modules/objects that want to receive events and it then
directly calls `HandleNotifierEvents()` on each object.

This change replaces/removes the `Notifier::Receiver` model and
simplifies the approach (reduces code-size and memory/RAM use).

For external modules (or in case the new model cannot be used by an
internal module), `Notifier` still provides the `RegisterCallback()`
model.
2020-08-10 09:15:42 -07:00
Simon Lin e4a9281054 [otns] fix otns status emission built by cmake (#5362)
Seems the strong otPlatOtnsStatus is not used, but the weak
otPlatOtnsStatus was used in the original code if built by cmake.

This commit fixes this issue. Now both cmake and make builds
correctly.
2020-08-10 09:12:38 -07:00
Abtin Keshavarzian 36b9ecbf11 [neighbor-table] add 'NeighborTable' class (#5354)
This commit adds a `NeighborTable` class which provides helper methods
dealing with neighbor, e.g., finding a `Neighbor` (i.e., a `Child`
from `ChildTable`, a `Router` from `RouterTable`, or parent or parent
candidate entries), or iterating through all neighbors.  These methods
use the newly added `Neighbor::AddressMacther` to simplify the
implementation. The `NeighborTable` methods replace the similar ones
in `Mle` and `MleRouter`.
2020-08-10 09:07:52 -07:00
Abtin Keshavarzian 6c75a53bdc [topology] adding 'Neighbor::AddressMatcher' (#5354)
This commit adds new a type `Neighbor::AddressMactehr` which is used
to filter and find a neighbor (child/router) with a given MAC address
matching a given `Neighbor::StateFilter`. This new type helps simplify
related code in `ChildTable`/`RouterTbale`.
2020-08-10 09:07:52 -07:00
Jonathan Hui 5bac12f9d6 [network-diagnostic] fix ConnectivityTlv::GetParentPriority() (#5360) 2020-08-07 12:26:54 -07:00
Jonathan Hui 03bcb408f9 [network-data] add nullptr check in Iterate() (#5359) 2020-08-07 12:26:29 -07:00
Simon Lin c112b9351d [docs] fix typo fortkey (#5356) 2020-08-07 10:31:17 -07:00
Moandor 45713b0dd2 [build] exclude URL library where unused (#5351)
This sets the URL library to be included only in POSIX builds,
removing unnecessary dependencies.
2020-08-07 10:23:55 -07:00
Abtin Keshavarzian b06f4cad20 [mac-frame] misc enhancements and simplifications (#5348)
- Use array indexing style `mPsdu[index]`.
- Update `InitMacHeader()` to use `mLength` directly.
- Add `using ot::Encoding::LittleEndian`
- Simplify `HeaderIe` definition (use `union`).
- Simplify `VendorIe` (use `uint32_t` for OUI).
- Simplify processing of Header IE(s) (using index) in
  `FindPayloadIndex()`, `GetHeaderIe()`, and `AppendHeaderIe()`.
2020-08-07 10:22:36 -07:00
Simon Lin d7343c877b [style] change python yapf column_limit to 119 (#5339) 2020-08-06 21:40:24 -07:00
Jonathan Hui e810357adb [cli] support reading individual operational dataset values (#5344) 2020-08-06 11:52:35 -07:00
Jonathan Hui f8a6d52695 [cli] add '::' to end of mesh local prefix output (#5344) 2020-08-06 11:52:35 -07:00
Jonathan Hui 73afdadaa8 [cli] print channel mask with leading '0x' (#5344)
To be conssitent with intput format.
2020-08-06 11:52:35 -07:00
Abtin Keshavarzian 0af18a54ae [mac-frame] fix/enhance parsing of Header IEs (#5342)
This commit changes `MacFrame::FindPayloadIndex()`:

- Ensure that at least one Header IE is included when FCF indicates
  that Header IE is present.

- Detect error case where Header IE(s) are partially included.

- Handle the case where frame contains Header IE(s) but no data
  payload (spec does not require Header IE termination in this
  case).
2020-08-05 21:30:20 -07:00
Simon Lin 36926a610a [tests] add build test for OT_ASSERT=OFF (#5333)
This commit adds a build test without OT_ASSERT to catch compile issues.
- Add cmake option: OT_ASSERT=ON
- Add build test with OT_ASSERT=OFF
- Fixes 2 compile errors.
2020-08-05 21:29:28 -07:00
Abtin Keshavarzian b9040673c9 [dns-client] move 'QueryMetadata' as a a private nested type (#5345) 2020-08-05 21:09:41 -07:00
Nate Drake 73a874ff9f [cli] add docs for 'commissioner state' command (#5343) 2020-08-05 21:06:56 -07:00
Jonathan Hui 659cf55a5a [coap] reduce OT_COAP_MAX_RETRANSMIT to 20 (#5338)
Also add a note to clarify the set of valid CoAP transmission
parameters.
2020-08-05 21:06:15 -07:00
Krzysztof Bogucki 3c132d4620 [ncp] fix spinel encrypter compilation errors after recent refactoring (#5341) 2020-08-05 13:00:53 -07:00
Krzysztof Bogucki 7183b24e65 [build] add SPINEL_ENCRYPTER_LIBS option to common switches (#5334)
This option allows to pass Spinel Encrypter library to predefined
Makefiles for different platforms.

Example usage:
make -f examples/Makefile-nrf52840 SPINEL_ENCRYPTER_LIBS=my_encrypter_lib.a
2020-08-05 12:59:28 -07:00
Abtin Keshavarzian 1cdb0e7767 [child-table] move child related methods to 'ChildTable' (#5335)
This commit moves `GetChildInfoById()`, `GetChildInfoByIndex()`, and
`HasSleepyChildWithAddress()`, along with methods for saving/restoring
child entries in/from non-volatile settings (e.g., `Restore()`,
`RemoveStoredChild()`, etc.) from `Mle` module to `ChildTable`. It also
removes/inlines the `MleRouter::IsSleepyChildSubscribed()` method.
2020-08-04 21:41:36 -07:00
Abtin Keshavarzian 3cd5f49d71 [encoding] add '{Read/Write}Uint24()` (#5329)
This commit adds `ReadUint24()`, `WriteUint24()` in `encoding.hpp`
for both little and big endian formats. These methods are then used
for reading/writing OUI in `MechCop::Tlv` sub-classes. This commit
also adds a check in `DiscoverScanner` to ensure the given OUI in
`SetJoinerAdvertisement` is within the valid range.
2020-08-04 09:07:25 -07:00
Abtin Keshavarzian 481f69703b [topology] define 'Neighbor::Info', 'Child::Info', and 'Router::Info' (#5328)
This commit adds new class definitions in `topology` to represent
neighbor/child/router info.
2020-08-03 21:33:34 -07:00
Simon Lin 5c6c798576 [scripts] add live capture for sniffer.py on simulation traffic (#5327)
This commit enhances sniffer.py so that we can use it as a standalone
sniffer for non Virtual Time simulations.
2020-08-03 09:25:14 -07:00
Abtin Keshavarzian be288331ac [mle-router] simplify 'GetNeighbor(const Ip6::Address &)' (#5326)
This commit simplifies `MleRouter:GetNeighbor(const Ip6::Address &)`
handling of mesh-local router locator IPv6 addresses.
2020-08-03 09:06:18 -07:00
Abtin Keshavarzian 471129460e [udp6] adding new flavors of Bind() and Connect() in Socket (#5319)
This commit adds new flavors of methods `Bind()` and `Connect()` in
`Udp6::Socket` allowing user to only specify a port number or provide
no input (address and/or port are determined by the UDP module itself
when not provided). The new methods help simplify `Socket` use in
different modules. This commit also enhances `SockAddr` class adding
new constructors to allow a `SockAddr` instance to be initialized with
a given port number or a given IPv6 address and port number.
2020-08-03 08:53:07 -07:00
Yuwen Lan addb1936c3 [joiner-adv] initial implementation of Joiner Advertisement (#5299)
This commit implements Thread based Joiner Advertisement from Joiner
side, including:

- A new MeshCop TLV: Joiner Advertisement TLV which includes IEEE OUI
  and the Advertisement Data.

- New APIs to set Joiner Advertisement which will be sent along with
  Discovery Request messages.
2020-08-03 08:38:58 -07:00
Rongli Sun b2f7414dac [dua] fix 1.2 compile issue without DUA flag (#5325) 2020-08-03 08:35:42 -07:00
Abtin Keshavarzian 3b6eb7de42 [core] use range-based 'for' loop (#5323) 2020-08-01 12:24:26 -07:00
Jonathan Hui 3b877e54ae [posix] fix macOS build with PLATFORM_NETIF=1 (#5318) 2020-08-01 10:54:20 -07:00
Jonathan Hui 075017bedc [commissioner] add 'state' CLI command (#5317) 2020-08-01 10:50:07 -07:00
Abtin Keshavarzian ccbb304969 [ip6] remove unused mScopeId from otSockAddr (#5316) 2020-08-01 10:40:49 -07:00
Abtin Keshavarzian cca72a660f [network-data] enhance OnMeshPrefix/ExternalRoute/Service configs (#5315)
This commit updates `OnMeshPrefixConfig` and `ExternalRouteConfig` to
be `Equatable`. It also adds a `ServerConfig` and adds overloads of
operator `==` to `Service/Server` configs. It also adds new method
`SetFrom()` to all configuration types to set them from a given set of
related TLVs.
2020-08-01 10:35:47 -07:00
Yakun Xu 114a0e7dc7 [posix] add UART flush and clean up (#5312)
This commit mainly implements the otPlatUartFlush().
- fix code because MSG_NOSIGNAL is not a macro.
- set SO_NOSIGPIPE once.
2020-08-01 09:41:58 -07:00
kangping f0f924a747 [tests] fix external commissioner building options (#5321)
This commit aligns the external commissioner building options with OT
commissioner.
2020-08-01 09:38:27 -07:00
Simon Lin 6488b25484 [netif] check address type when adding addresses (#5297) 2020-07-31 09:33:48 -07:00
Rongli Sun 82e7e32bb5 [dua] dua registration and re-registration (#5276)
- registration workflow framework
- registration and reregistration
- registration and reregistration on behalf of children
- add pseudo response status for test/certification purpose
- add unit test
2020-07-30 14:10:22 -07:00
Abtin Keshavarzian 8c094c6ac2 [ip6] adding Ip6::Prefix class (#5306)
This commit adds `Ip6::Prefix` class as a sub-class of `otIp6Prefix`
representing an IPv6 Prefix. Helper methods are provided in `Prefix`
and `Address` to perform prefix matching.

Different core modules such as `network-data`, `lowpan`, `dhcp6`,
`slaac`, and, `backbone-router` are updated to use the new `Prefix`
and its helper methods.

This commit also updates the unit test `test_ip6_address` to verify
behavior of `Prefix` and its helper methods.
2020-07-30 08:25:02 -07:00
Simon Lin b49ee0879a [posix] ot-ctl process lines for non-interactive mode (#5134)
This commit enhances ot-ctl to process only after a full line is read
in non-interactive mode.

This eliminates the complex and error-prone states handling, which
still has potential issues (despite of small chance):

- If Done\r\n is received in two chunks: Done\r and \n, the original
  implementation won't output \n

- If Error 7: InvalidArgs is received in two chunks: Error and 7:
  InvalidArgs, the original implementation won't output 7: InvalidArgs
2020-07-29 11:38:28 -07:00
Moandor 0ef8f510c5 [test] fix network name capturing in expect scripts (#5284)
This fixes some expect test failures caused by the following scenario:
Sometimes the command prompt > can be put after the echo of the input
command when inputs come too fast, because we are sending the next
command as soon as we see Done, we don't wait for the next > .

This commit adds expect "> " before sending the command to fix this.
2020-07-29 11:36:06 -07:00
Li Cao 7fe1d29ab4 [cmake] fix link issues of unit tests (#5309)
I think openthread-ncp-ftd is added to unit tests' link libraries by
mistake. It's not required and as it depends on OT_PLATFORM, it would
cause openthread-simulation linked in unit test executables, which
would lead to a redefinition as some methods are defined in
test-platform.cpp.
2020-07-29 11:24:57 -07:00
Abtin Keshavarzian 1dd46f9d93 [posix] fix netif use of IPv6 Prefix Match method (#5305) 2020-07-28 10:48:18 -07:00
Simon Lin d46c03b588 [bit-vector] refactor methods (#5302)
This commit refactors BitVector to use one method for setting or
clearing masks.
2020-07-28 09:09:52 -07:00
Abtin Keshavarzian 89b657cc60 [dhcp6] misc enhancements (#5294)
This commit contains a bunch of smaller changes and enhancements
in dhcp6 modules:

- Add and use `TransactionId` class.
- Rename header to `Dhcp6::Header` and update `Dhcp6::Type`.
- Rename server/client to `Dhcp6::Server` and `Dhcp6::Client`.
- Rename/update `DuidType` constants.
- Use `Mac::ExtAddress` as link address in `Server/ClinetIndentifer`.
- Use `Ip6::Address` instead of `otIp6Address`.
- Add `enum` constants for default values (remove `#define`)
- Define `IdentityAssociation` as nested type of `Client`.
- Update documentation.
2020-07-28 08:33:52 -07:00
Simon Lin 1081b45bec [mlr] Parent send MLR.req on behalf of Children (#5236)
This commit implements parents sending MLR.req on behave of Children.

- Parent sends MLR.req for Children after delaying for a random time <
  PARENT_AGGREGATE_DELAY (5s).
- Update test script to check for proxied MLR.req
- Parent proxy MLR.req for Children after a delay t in [0, 5]
2020-07-27 20:29:08 -07:00
Yakun Xu cbf1a19483 [cli] support joiner discerner (#5298)
This commit adds support joiner discerner in CLI. The format of joiner
discerner is `number/length`. For example `0xabc/12` means the discerner
value is `0xabc` and the length is `12`.
2020-07-27 20:27:21 -07:00
Rongli Sun 2117dae5f8 [mle] kAppendMeshLocalOnly for Child Update Request when detached (#5295)
When the child reboot, only register the mesh local address to avoid
possible large Child Update Response which would be fragmented, thus
avoiding reattach process.
2020-07-26 22:16:13 -07:00
Jonathan Hui c5e7252fed [docs] update Docker badge to GitHub Action (#5287) 2020-07-24 22:47:58 -07:00
Simon Lin adde385643 [netif] enhance IterateExternalMulticastAddresses (#5277)
This commit enhances IterateExternalMulticastAddresses to use further
filter external multicast addresses.
2020-07-24 22:47:18 -07:00
Abtin Keshavarzian ac86fe52e6 [bit-vector] add missing header includes (#5289) 2020-07-23 22:56:03 -07:00
Li Cao 692511070f [data-poll-handler] fix doc typo for DataPollHandler::Callbacks (#5288) 2020-07-23 22:55:24 -07:00
Abtin Keshavarzian 25c058d8ad [mle] use newly added Netif::IterateExternalMulticastAddresses (#5286)
This commit updates `Mle` class to use the newly added `Netif`
iterator for external multicast addresses. It also adds a helper
method in `Netif` to indicate if it is subscribed to any external
multicast address.
2020-07-23 22:53:55 -07:00
Simon Lin fd66f2399f [thci] add OpenThread_BR THCI for OTBR CLI (#5085) 2020-07-23 16:34:19 -07:00
Abtin Keshavarzian c89fd9a8f5 [mesh-forwarder] simplify GetFramePriority() (#5282)
This commit simplifies the `GetFramePriority()` implementation
mainly avoiding copying of ICMP6/UDP header when possible.

It also updates unit test `test-toolchain` to verify alignment
behavior of packed structure.
2020-07-23 12:54:44 -07:00
Abtin Keshavarzian 2efe99c507 [child] enhance Child::AddressIterator (#5269)
This commit enhances the iterator `Child::AddressIterator` which is
used to iterate over IPv6 address list of a `Child`. The new model
enables range-based `for` loops to be used. It also enables filtering
addresses based on type (e.g., iterate over multicast addresses only).
The unit test `test_child.cpp` is also updated to verify the newly
added functionalities of `AddressIterator`.
2020-07-23 12:16:45 -07:00
Jonathan Hui 7a612437ed [github-actions] add building Docker images (#5273)
The openthread/environment and openthread/codelab_sim images are
currently built and updated via the Docker Hub service. Docker Hub
only allows a single runner at a time and is generally slower than
GitHub Actions.

This commit moves the Docker image build and update to GitHub Actions.
2020-07-23 10:49:55 -07:00
Simon Lin d14a14a494 [core] add BitVector template class (#5267) 2020-07-23 00:33:09 -07:00
Kamil Kasperczyk 6640e7d865 [cmake] added ncp vendor hook include directories for .hpp files from src (#5275)
Added include directories to enable including .hpp ncp files
outside src directory, what is needed for vendor hooks concept.

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2020-07-22 23:19:36 -07:00
Abtin Keshavarzian 90db2d2ee7 [core] replace memcpy with assignment (#5280)
Also remove few unncessary uses of `this` pointer.
2020-07-22 17:17:47 -07:00
Abtin Keshavarzian bd197d3f47 [settings] use Equatable/Clearable in Settings structures (#5281) 2020-07-22 16:05:44 -07:00
Jonathan Hui 85de837187 [github-actions] fix external-commissioner test (#5279)
- Install avahi-daemon and avahi-utils packages.
- Remove ot-br-posix dependencies.
2020-07-22 14:09:03 -07:00
Piotr Koziar a374905a1d [nrf_security] remove inconsistency from nrf_security config file (#5265) 2020-07-22 10:05:59 -07:00
Abtin Keshavarzian 812eeee027 [settings] enhance Settings::ChildInfoIterator (#5272)
This commit updates `ChildInfoIterator` in `Settings` class to
enable range-based `for` loop.
2020-07-22 08:48:12 -07:00
Abtin Keshavarzian df2fa4c548 [router-table] add documentation for Iterate() method (#5270) 2020-07-22 08:40:22 -07:00
Simon Lin 00f3043a06 [mlr] send MLR.req for local multicast addresses (#5248)
This commit includes:

- Adding compile configurations necessary for MLR features
- Adding source/header files necessary for MLR features
- Send MLR.req for local MAs on ThreadNetif
  - At most one MLR.req is outstanding
  - Reregistration according to PBBR configuration
  - Renewing periods according to PBBR configuration
- BBRs receive MLR.req with minimal processing and send MLR.rsp
- Add a test to verify that MLR.req is sent for local MAs.
2020-07-22 08:38:05 -07:00
Simon Lin 2129b567b4 [otns] emit device mode (#5268)
This commit allows OTNS to correctly visualize node mode when it
changes.
2020-07-21 23:09:18 -07:00
Simon Lin 5e9b2818eb [style] convert to C++11 for loops (#5263) 2020-07-21 09:41:40 -07:00
Rongli Sun 57ee45be21 [mle] enhance IsExpectedToBecomeRouter() (#5261) 2020-07-20 23:27:56 -07:00
Rongli Sun 5f01bc48f5 [dua] apply DUA logging region (#5262) 2020-07-20 23:26:12 -07:00
Rongli Sun 8d1060fb60 [logging] Add DUA region (#5262) 2020-07-20 23:26:12 -07:00
Rongli Sun 6c1abeab90 [mle] add mHasRestored flag (#5228)
This commit introduces the mHasRestored flag and a common
HasRestored() method as devices may decide to introduce some
jitter/randomization to avoid the burst of traffic in cases a bunch of
devices nearby resets/reboots together.
2020-07-20 23:24:57 -07:00
Abtin Keshavarzian 2d38c59a5a [key-manager] add GenerateRandom() to MasterKey class (#5260) 2020-07-20 23:19:10 -07:00
Rongli Sun c0442e88e8 [address-resolver] TimeSinceLastTransaction should be in seconds (#5264) 2020-07-20 23:07:29 -07:00
Abtin Keshavarzian ceb63f97d5 [router-table] enable use of range-based "for" loop (#5254)
This commit updates `RouterTable` class to add support for using
range-based "for" loops to iterate over all routers.
2020-07-20 08:42:01 -07:00
Jing Ma e8fe3bd6e7 [thread-cert] deprecate certification test case 5.5.8, 5.6.8, 5.8.1 (#5246)
5.5.8, 5.6.8 and 5.8.1 were deprecated in Thread Certification test plan.
2020-07-20 08:40:04 -07:00
Abtin Keshavarzian d5370ac4cd [ip6] define NetworkPrefix type (#5213)
This commit adds `Ip6::NetworkPrefix` mirroring `otIp6NetworkPrefix`
which represents the Network Prefix (most significant 64 bits) of an
IPv6 address. Methods in `Ip6::Address` are updated to use the new
type. The `otMeshLocalPrefix` and `Mle::MeshLocalPrefix` are also
updated use the `NetworkPrefix` type.
2020-07-20 08:38:16 -07:00
Simon Lin 434e6bbffc [logging] add MLR log region (#5250) 2020-07-17 08:53:40 -07:00
Jonathan Hui 85af5f1963 [meshcop] do not allow timestamp rollback on leader (#5249) 2020-07-17 08:50:09 -07:00
Jonathan Hui c394080617 [ncp] only allow promiscuous mode in link raw mode (#5245)
Many existing IEEE 802.15.4 radios do not support both promiscuous
mode and auto generation of immediate ACKs. This commit prevents
promiscuous mode when the interface is up.
2020-07-17 08:49:51 -07:00
Abtin Keshavarzian a1f0b21c16 [coap-secure] inline simpler methods (#5255) 2020-07-17 08:49:10 -07:00
Abtin Keshavarzian 77d35929ce [dns/sntp-client] use Instance as a constructor parameter (#5253) 2020-07-17 08:47:52 -07:00
kangping c6d5c4aae0 [dtls] increase maximum length of DTLS application data (#5125)
This commit increases the maximum allowed length of DTLS application
data from 512 bytes to 1152 bytes.

The maximum possible length of application data is just around 512
bytes, and we observed that a Client Hello with cookie encoded in
RLY_RX.ntf message could be 520 bytes.
2020-07-16 11:17:02 -07:00
Simon Lin d2a625eb41 [logging] fix typo in comments (#5251) 2020-07-16 08:52:25 -07:00
Yaoxing Shan a67fa9b5e7 [docs] add Chinese translation for Thread Primer (#5106) 2020-07-16 08:44:02 -07:00
Yakun Xu 89cd4b59f8 [url] move url to library (#5233)
This commit moves the URL parser to src/lib.

Also includes the following changes:
- Split URL on initialization.
- Make a GetValue() const method.
- Check aLastValue.
- Add some negative tests.
2020-07-15 23:39:02 -07:00
Abtin Keshavarzian 4e8836cbec [child-table] enable use of range-based "for" loop (#5239)
This commit updates `ChildTable` class. It mainly adds support for
using range-based `for` loops to iterate over all child entries
(matching a given state filter). It also simplifies the `Iterator`
implementation (removing the now unused behavior to start the
iteration from a specific child in the table). The unit test
`test_child_table` is also updated to add tests for the newly added
behavior.
2020-07-15 23:07:16 -07:00
Moandor 6e98f3bb5b [test] move expect timeout settings to _common.exp (#5242)
This moves all settings of timeout to one place. Also changes the
default timeout to 10 seconds, can probably solve the occasional
timeout when dataset commit active.
2020-07-15 20:57:56 -07:00
Bob MacDonald b6027f9e65 [efr32] fix build errors due to recent change of otUdp APIs (#5243)
The commit which resulted in the compilation issues is: dc1d47
2020-07-15 14:37:12 -07:00
Rongli Sun 32618835c2 [bbr] rename as HandleBackboneRouterPrimaryUpdate (#5240) 2020-07-15 12:25:58 -07:00
Rongli Sun daf89169c6 [bbr] rename file name with bbr_ prefix (#5240) 2020-07-15 12:25:58 -07:00
Yakun Xu 4886b53b5c [github-action] remove unused apt source lists (#5237)
These sources break easily, removing them so that apt-get update
doesn't fail.
2020-07-15 10:48:23 -07:00
Yakun Xu bd3332810a [script] use real time when run expect tests (#5130) 2020-07-15 10:47:29 -07:00
Mason Tran 5ce29eb89c [efr32] fix otPlatRadioGetRssi() for MG1, MG12, MG13 (#5238)
This fixes an issue with Channel Monitoring for the EFR32 platform
(MG1, MG12, MG13), where in, turning the radio to a new channel and
immediately gathering background RSSI information was returning
invalid results.

A further investigation with the RAIL team indicated that this issue
was occurring because the usage of `RAIL_GetRssi()` is
incorrect. While the Rail_GetRssi API functions as documented, the
problem is that the current implementation of this API returns valid
results only in certain specified radio states and does not fit the
use case for the OpenThread Channel Monitoring feature. (i.e computing
RSSI value in the RxWarm radio state).

To fix the issue, I am switching the affected platforms to the
efr32mg21 implementation for `otPlatRadioGetRssi()`, which uses
`RAIL_StartAverageRssi()` instead of
`RAIL_GetRssi()`. `RAIL_StartAverageRssi()` uses hardware to trigger
an interrupt once the RSSI is valid and should provide valid results.

This approach was added by Marven when testing DMP support with
OpenThread (https://github.com/openthread/openthread/pull/4321)
2020-07-14 20:48:54 -07:00
Simon Lin 51f9d2cb9d [tests] ignore unknown TLV (#5232)
This commit ignores unknown TLVs when parsing a message and continues
to parse the rest parts of the message.

An unknown TLV can cause the simulator to drop the whole packet, which
could lead to packet parsing issues.  For example, if a Child ID
Response message is dropped, the dissector will fail to add the Short
Address and Extended Address to the Device Descriptors, causing
subsequent secure packets unable to be decrypted.
2020-07-14 20:40:34 -07:00
Yakun Xu b88f4fccba [flash] avoid build when not needed (#5235) 2020-07-14 10:04:12 -07:00
Abtin Keshavarzian dc1d47d2c0 [udp6] update UDP socket definitions (#5231)
This commit updates the  public OT `otUdp{}` (like `otUdpConnect`, or
`otUpdSend()`) functions to requires a pointer the OpenThread instance
to be passed as their first parameter (this harmonizes the definitions
with other public APIs and removes the need for `otUdpSocket` to track
the instance).

The core implementation in `udp6` module is updated to define
`SocketHandle` as an internal mirror of `otUdpSocket` structure. The
socket related methods `Open`(), `Bind()`, `Connect()`, etc., are
moved to `Udp` class itself (with a `SocketHandle` passed as a
parameter). For core internal use `Socket` class is defined as a
sub-class of `SocketHandle` and `InstanceLocator` providing same
helper methods. The separation between `SocketHandle` and `Socket`
type addresses the problem that can be caused by the treating/casting
publicly provided `otUdpSockt` objects as `InstanceLocator`.
2020-07-14 10:03:03 -07:00
Rongli Sun 9c660f6425 [dua] add IsDomainUnicast() helper method (#5230) 2020-07-13 20:53:43 -07:00
Yakun Xu b9a7903f19 [github-action] check with cmake version 3.10 (#5229) 2020-07-13 08:22:00 -07:00
Rongli Sun 32a3bef6dd [test] fix python formatting in v1_2_* tests (#5225)
In some test scripts, %s and format() are used by mistake.
2020-07-13 08:18:51 -07:00
Simon Lin 848feb5aa5 [bbr] validate BBR configuration (#5221)
This commit makes sure BBR configuration is valid according to Thread
Spec 5.21.3.3.
2020-07-13 08:16:47 -07:00
Jintao Lin 4806fa4d0d [platform] fix transmit security for RCP (#5223) 2020-07-10 15:05:54 -07:00
Jonathan Hui aa1a610203 [docker] remove stale Dockerfiles (#5214) 2020-07-10 11:05:21 -07:00
Abtin Keshavarzian cd2b183251 [dtls] small enhancements (#5220)
This commit contains few small enhancements in `Dtls`:

- It renames the `GetPeerAddress()` to `GetMessageInof()` (to indicate
  that it returns `Ip6::MessageInfo` and not just peer socket address).
  (it also renames the variable to `mMessageInfo` from `mPeerAddress`).

- Declares `Ip6::MessageInfo` to be `Clearable` and uses the `Clear()
  method instead of `new` operator to clear the `mMessageInfo`.

- Uses helper methods to set the peer socket address (remove `memcpy`).
2020-07-10 10:11:10 -07:00
Simon Lin a7c0f51b9b [utils] add ChildMask class (#5206)
This commit adds the ChildMask class so that it can be reused by other
modules.
2020-07-10 10:03:17 -07:00
Mason Tran 71c16d9558 [efr32] fix broken radio.c in EFR32MG21 (#5217)
processNextRxPacket() on the EFR32MG21 platform takes a RAIL handle as
a second argument.
2020-07-09 09:15:40 -07:00
Colin Tan ff712ca8e1 [otns] fix extaddr byte order (#5216)
The extended address already has byte order reversed when calling
aFrame.GetDstAddr(dst). The reversal logic is therefore not
needed.
2020-07-08 22:46:50 -07:00
Abtin Keshavarzian 83d5bcf70b [diag-tlvs] remove unused TLV types (#5215)
This commit removes unused simple `NetworkDiagnosticTlv` sub-types.
For simple TLVs we use helper method to directly parse/append the TLV
from/to a message, so the TLV sub-type class is not needed or used.
2020-07-08 22:43:46 -07:00
Abtin Keshavarzian 9acd16a1a2 [string] add String::AppendHexBytes() (#5212)
This method appends a given array of bytes in hex representation
(`%02x` style) to a `String` object. This method helps simplify the
`ToString()` methods in simpler types (e.g., `Mac::ExtAddress`).
2020-07-08 22:36:16 -07:00
Moandor 4e0dc03e96 [cli] add netstat command (#5202) 2020-07-08 22:26:41 -07:00
Mason Tran d964694d19 [efr32] process received packet immediately (#5197)
When analyzing the energy mode transitions for a sleepy node, running
the sleepy-demo-mtd app, it was observed that, the current
implementation of the platform radio driver (efr32RadioProcess())
although correct, can be optimized by processing the next received
packet (processNextRxPacket()) before other actions being carried out
in this routine. For example, in a situation where a 802.15.4 MAC Ack
needs to be processed in response to a sent packet, adding this call
towards the end of this routine then delays stack notification (that a
Tx was done) until the next call to efr32RadioProcess().
2020-07-08 18:05:36 -07:00
Yakun Xu 36533b01e1 [script] fix unbound variable in macOS (#5210) 2020-07-08 10:44:44 -07:00
Jonathan Hui 6dd57816ee [cmake] move minimum version to 3.10.2 (#5208)
To support automated armv7 docker builds.
2020-07-08 10:42:09 -07:00
Abtin Keshavarzian 04b35d0422 [udp/tcp/icmp] simplify Header parsing, and declare related types as nested (#5203)
This commit contains two main changes in `Ip6` modules: `Udp`, `Tcp`,
and `Icmp`. First, it simplifies the `Header` types defining constant
`enum` for byte offset of different fields in the header (these
replace the static methods and avoid use of `offsetof` macro). Second
change is it declare related types in each module as nested types of
the the main class (place them under the namespace of the main type).
For example `Icmp::Header`, `Udp::Socket` respectively replace
`IcmpHeader`, `UdpSocket` types.
2020-07-08 10:41:00 -07:00
Moandor abeb02fc52 [test] fix external commissioner coverage data uploading (#5207)
This makes the external commissioner test to copy coverage files from
otbr to $PWD/build so they are uploaded correctly.
2020-07-08 00:04:53 -07:00
Eduardo Montoya 396d23cd06 [dtls] explicitly configure ECJPAKE parameters (#5192)
This commit:

- Uses the mbedtls API to explicitly fix the number of used curves to
  one when using ECJPAKE, as required by Section 3 of
  draft-cragie-tls-ecjpake-01.

- Uses the mbedtls API to explicitly remove the Signature Hash
  Algorithms when using ECJPAKE.
2020-07-07 19:05:19 -07:00
Abtin Keshavarzian eee173af0b [ip6-address] update and use Ip6::InterfaceIdentifier class (#5194)
This commit updates `Ip6::InterfaceIdentifier` class adding new helper
methods to it (e.g., generate random IID, or convert IID to/from a MAC
Extended Address). It also updates the `Ip6::Address` methods (related
to getting/setting/checking IID) to use the `Ip6::InterfaceIdentifier`
type.

The larger change in this commit is to update other core classes and
modules (`Lowpan`, `Mle`, `Settings`, 'AddressResolver', `Child`,
etc.) to use the `Ip6::InterfaceIdentifier`/`Ip6::Address` type and
their new/changed methods.

This commit also adds a new `struct` type `otIp6AddressComponents` to
the public OT API header `ip6.h`. This type represents the components
of a (unicast) IPv6 address, i.e. a network prefix and an IID. The
`otIp6Address` uses the new type as one of its `union` representations
of an IPv6 address.
2020-07-07 18:02:34 -07:00
Abtin Keshavarzian e29143b089 [pool] introducing a generic object pool class (#5193)
This commit adds a template `Pool<Type, kPoolSize>` class representing
an object pool. `Message`, `Netif`, and `AddressResolver` classes are
respectively updated to use `Pool` for managing their buffer pool,
external unicast/multicast address pool, and address cache entry pool.
This commit also adds a unit test for the `Pool` class.
2020-07-07 17:59:25 -07:00
Jintao Lin f7e16fec24 [nrf528xx] add platform radio support for transmit security (#5184) 2020-07-07 13:12:50 -07:00
Eduardo Montoya 9f0df30493 [meshcop] JR: don't wait for previous rsp to send a new JOIN_ENT.ntf (#5199)
The existing Joiner Entrust process is as follows:

- The Joiner sends JOIN_FIN.req and receives JOIN_FIN.rsp from the
  Joiner Router.

- The Joiner sets up a 4000 ms timer to receive the JOIN_ENT.ntf.

- The Joiner Router generates the JOIN_ENT.ntf and enqueues it,
  setting up a 50 ms timer to send it.

- When the Joiner Router timer triggers it sends the heading message
  from the queue ONLY if the previous transaction already
  completed. This is done like this because whenever a new
  JOIN_ENT.ntf is sent the KEK in the KeyManager is changed, and it's
  required to keep it in order to decrypt the CoAP ACK.

This approach presents a couple of issues:

- It blocks the message queue up to the maximum CoAP transaction time,
  which can be much longer than the Joiner 4 seconds timeout.

- Even worse, if the CoAP ACK never arrives, no more messages would be
  released from the queue, even future enqueued ones.

This commit removes this queue blocking, assuming the risk of an
enqueued JOIN_ENT.ntf being sent before the previous ACK has
arrived. In that case there are two options:

- The previous JOIN_ENT.ntf was not delivered and the previous Joiner
  would need to start over the whole Commissioning process again.

- The previous JOIN_ENT.ntf was delivered but the ACK was not
  received. This has impact only in the Joiner Router logs.

But even for the first case the chances are very low (a JOIN_ENT.ntf
enqueued to be triggered just a few milliseconds after the first one)
and situation is much better than the previously existing one.
2020-07-07 11:40:26 -07:00
Simon Lin d3a429b1ea [mle] fix invalid router after ProcessRouteTlv (#5200)
We always need to update existing router references after calling
ProcessRouteTlv.
2020-07-07 11:11:17 -07:00
Moandor f490ea658c [test] add external commissioner tests (#5187)
This adds tests of ot-commissioner as part of GitHub Action workflows.
2020-07-06 20:34:21 -07:00
Gary Palmer 180f5824dc [logging] fix benign typecast issue in otDump (#5198)
Fixes a benign typecast issue found when using the IAR compiler.
2020-07-06 20:26:11 -07:00
gabekassel 716e5f0726 [efr32] Silabs EFR32MG1 Platform Support (#5191)
This adds platform support for Silabs EFR32MG1 (series1 Mighty Gecko
with 32K RAM + 64K flash).

A few notes on this commit:

- MG1 cannot fit FTD builds with certain options enabled (like
  diagnostics). In testing, I simply removed FTD from build
  options. We may want to add this to README

- Most platform files are directly duplicated from MG12

- Only created BRD4151A reference. Suspect Silabs team will want to
  add other reference platforms like Thunderboard 1

- Should include latest crypto acceleration changes made by Silabs
  team

- This has been tested using RCP and CLI builds both on BRD4151A WSTK
  and a custom design based on MG1.
2020-07-06 20:08:09 -07:00
Colin Tan e7e69065b6 [otns] add radio event status emission (#5195)
This commit adds code in base radio implementation to emit radio
events to logs, when OTNS is turned on. This is for Silk-OTNS
integration's message visualizations.
2020-07-06 15:15:10 -07:00
Moandor 203774c181 [test] add expect tests for commissioner and udp (#5196) 2020-07-06 08:39:53 -07:00
Moandor f75076078c [test] add missing expect test cases for dataset commands (#5182) 2020-07-06 08:13:14 -07:00
Moandor d164146010 [test] print debug info when expect tests fail (#5181)
This stores debug logs from expect and prints them if a test fails to
enable easier debugging.
2020-07-03 09:29:54 -07:00
Yakun Xu 74fd255465 [joiner] check Thread state on start (#5173) 2020-07-03 09:24:52 -07:00
Bob MacDonald 2a05a4c5f2 [efr32] fix compilation issues efr32*/flash.c (#5189) 2020-07-03 09:22:35 -07:00
Gary Palmer 5f0e36eeb2 [mac-frame] remove unused variable in TxFrame::ProcessTransmitAesCcm() (#5185)
Eliminated an unused variable discovered when building using IAR.
2020-07-02 15:49:06 -07:00
Abtin Keshavarzian 4584deeae0 [udp6] use newly added linked-list to search for a matching socket (#5180)
This commit adds `UdpSocket::Matches()` to match a UDP socket with a
given `MessageInfo`. This is then used alongw with the newly added
linked-list `FindMatching()` method to find a matching socket from the
list of UDP sockets in `Udp::HandlePayload()`.
2020-07-02 15:46:11 -07:00
Abtin Keshavarzian 2184d2ce0f [netif] use newly added linked-list helper methods (#5179)
This commit simplifies the `Netif` implementation by using newly added
`LinkedList::FindMatching()` methods to search in unicast/multicast
address list for an entry matching a given IPv6 address.
2020-07-02 15:44:42 -07:00
Mason Tran 53c3940c1a [efr32] remove unnecessary nvm3 calls (#5178)
This removes unnecessary open/close calls that were being made when
handling nvm operations.

In a normal mode of operation, the nvm open call should be made only
once during initialization.

The only way these changes could be verified was by building a binary,
flashing it on a node and making sure that the node's network operations
(like forming a network) were okay.
2020-07-02 15:43:43 -07:00
Moandor fbacefe85c [test] add expect tests for coap and coaps (#5172)
Also adds command coaps set to make it consistent with coap set.
2020-07-02 15:40:18 -07:00
Abtin Keshavarzian ce9040950e [dtls] misc enhancements (remove unused defs, declare enum as private) (#5176)
This commit contains the following:

- Remove unused `SendHandler` type and `mSendHandler` variable.
- Follow style guide for `#endif` comments.
- Define `Dtls::State` as private.
- Define DTLS module constant enums as private.
- Ensure `mReceiveHandler` is not null before invoking.
- Inline simple setter `SetSslAuthMode()`.
- Follow style guide for param names in `HandleMbedtlsDebug()`.
2020-07-01 16:51:51 -07:00
Abtin Keshavarzian 30343ce753 [addr-resolver] use new linked list method to find cache entry matching an EID (#5174) 2020-07-01 16:51:10 -07:00
Abtin Keshavarzian 5ebd885996 [linked-list] add new template {Contains/Find/Remove}Matching() methods (#5174)
This commit adds new methods in `LinkedList` to search in the list for
an entry matching a given entry indicator (specified with a template
`Indicator` type). To use these methods, users are expected to provide
method `bool Matches(const Indicator &aIndicator) const` on the entry
`Type` itself (which is then used to match each entry in the list with
the indicator). This commit also changes the linked-list methods to
use `Find()` internally. Finally it updates the linked-list unit test
to cover behavior of the newly added methods.
2020-07-01 16:51:10 -07:00
Jonathan Hui a795db710f [dhcp6-client] update DHCPv6 service RLOC on new network data (#5169) 2020-07-01 16:48:27 -07:00
Jonathan Hui 88e2ca5714 [dhcp6-client] only close socket if no agents exist (#5169) 2020-07-01 16:48:27 -07:00
Abtin Keshavarzian ae34357023 [netif] misc enhancement (#5168)
This commit contains some smaller enhancements in netif:

- Add method to check if unicast/multicast address is external or
  internal (e.g., `IsUnicastAddressExternal`)
- Simplify iteration over (external) multicast addresses and remove
  `GetNextExternalMulticast()`.
- Use range-based `for` loop for iteration over external address
  arrays.
- Rename `IsUnicastAddress()` to `HasUnicastAddress()`.
- Clarify method documentation specially between internal and
  external addresses (how the passed-in address parameter is used,
  i.e., copied into another entry from an address pool for external
  vs. directly used for internal addresses).
2020-07-01 14:24:03 -07:00
Yaoxing Shan 9920685b8d [devsite] fix wrong description in Thread Primer (en) (#5163) 2020-07-01 10:43:05 -07:00
Moandor 68e66bc633 [continuous-integration] add SPI build check (#5165)
Enables NCP SPI in build checks. Also fixes some build errors in SPI code.
2020-06-30 22:52:31 -07:00
Simon Lin baa6523766 [otns] fix simulation to use strong otPlatOtnsStatus definition (#5171)
- fix otPlatOtnsStatus(weak) is not used
- use the current openthread rather than openthread master
2020-06-30 22:49:50 -07:00
Colin Tan 5ce4046751 [otns] add default implementation for otPlatOtnsStatus (#5155)
This commit adds a default implementation for otPlatOtnsStatus, which
emits OTNS status messages to log, so that OTNS=1 could be used with
real devices. This is required for the Silk-OTNS integration work, as
Silk will pick up these messages and reroute them to OTNS for
visualization purposes.
2020-06-30 13:02:50 -07:00
Simon Lin b0bff4f8c3 [github-actions] fix expects fail by chance (#5157)
This commit tries to reduce expects fails in GitHub actions:
- wait_for only sends command when it's not empty
- increases the default expect timeout from 1s to 3s.
2020-06-30 11:01:10 -07:00
Yakun Xu eaaaa59071 [posix] wait for writable before next try (#5143)
This commit waits fd to be writable before try writing next time.
2020-06-30 11:00:11 -07:00
Jonathan Hui 284cd96886 [devsite] add clarifications to multicast addressing primer (#5160) 2020-06-30 08:48:08 -07:00
Jonathan Hui 6930dd3603 [bootstrap] update bootstrap user messages (#5161)
- Indicate that pretty tools are primarily used for code contributions.

- Change to bash.
2020-06-30 08:47:01 -07:00
Abtin Keshavarzian 0ae329c21d [linked-list] fix Find() when list is empty (#5164)
This commit fixes the `LinkedList::Find()` implementation when list is
empty. It also updates the unit test for linked-list to verify the
`Find()` (particularly when it is expected to fail and not find the
entry in the list).
2020-06-30 08:43:31 -07:00
Moandor 5acad30791 [test] include CLI tests in RCP mode (#5159)
This makes expect run all cli-*.exp and posix-*.exp tests in RCP mode.
New scripts should use the function spawn_node in _common.exp to spawn
new processes. This is compatible with both simulation mode and RCP
mode.
2020-06-30 08:40:46 -07:00
Abtin Keshavarzian d65f8a3812 [meshcop] fix typos in joiner/commissioner method documentation (#5154) 2020-06-29 12:53:00 -07:00
Abtin Keshavarzian 560fee9698 [toranj] add test covering meshcop with Joiner Discerner (#5154)
This commit adds a `toranj` test-case covering the commissioning
behavior using a Joiner Discerner:
- Verifies setting and clearing discriminator with different values
  and bit-lengths (on a Joiner).
- Verifies commissioning using discerner (and EUI64).
- Verifies that commissioner would prefer a Joiner entry with the
  longest matching discerner length.
2020-06-29 12:53:00 -07:00
Yakun Xu bd078f1b30 [test] fix multiple extra options (#5158) 2020-06-29 09:04:01 -07:00
Abtin Keshavarzian 6f1fc2e6c2 [mac-filter] misc enhancements (#5151)
This commit contains some smaller enhancements in `Mac::Filter`:

- Use C++11 range-based `for` loop when iterating over filter entries
- Define `Filter:Mode` enum (mirror of `otMacFilterAddressMode`)
- Change `Filter::SetMode()` and `otLinkFilterSetAddressMode()` to
  return `void`.
- Simplify `Filter::Apply()` implementation.
- Add new separate public OT and internal APIs to set/clear default
  RSS-In (e.g., `SetDefaultRssIn()`/`ClearDefaultRssIn()`).
- Return no error (instead of `ALREADY`) from `Filter::AddAddress()`
  and its corresponding public `otLinkFilter` API when entry is already
  present in the list.
- Do not return `NOT_FOUND` error from `Filter::Remove{Address/RssIn}()`.
- Update public `otLinkFilter{API}` documentation.
- Update NCP and CLI code to adopt new `otLinkFilter` APIs.
2020-06-29 08:59:34 -07:00
Rongli Sun ce1b8e6762 [mle] suppress parent response when >= 32 active routers (#5156)
This commit introduces one extra parent response rule:
REED doesn't respond parent request if there are already
`kMaxRouters` active routers in the Thread network as it's
for sure that Leader will reject its address solicit.
2020-06-29 08:57:01 -07:00
Abtin Keshavarzian 9e291e62ed [commissioner] use c++11 range-based for and explicitly typed enum (#5137) 2020-06-26 16:02:09 -07:00
Abtin Keshavarzian a7415b53a4 [ncp] add support for Joiner Discerner and getting list of joiners (#5137)
This commit adds/updates spinel properties to add Joiner Discerner
support on joiner and commissioner side. It also adds support for
getting the list of joiners on commissioner by implementing property
get handler for spinel property `MESHCOP_COMMISSIONER_JOINERS`.
2020-06-26 16:02:09 -07:00
Abtin Keshavarzian c7dc2be7d2 [joiner] adding otJoinerPskd and JoinerPskd types (#5137) 2020-06-26 16:02:09 -07:00
Abtin Keshavarzian 5210ca3eee [meshcop] adding otJoinerDiscerner (#5137)
The `otJoinerDiscerner` enables new a mechanism for Thread
commissioning. The traditional Thread commissioning process uses
factory assigned EUI-64 of the device to derive the Joiner ID and
identify/filter a joiner (through steering data bloom filter). The
Joiner Discerner (which is an unsigned value along with a
user-specified bit length up to 64 bits) allows users to have more
control and do not rely on factory-assigned EUI-64.

On joiner side, when a a Joiner Discerner value is provided, the
Joiner code uses the discerner value to derive Joiner ID (appending a
random prefix to extend the value to 64 bits) and bloom filter.

On commissioner side, users can add different joiners providing either
an EUI-64 or an associated Joiner Discerner and the code accordingly
match the Joiner IDs and compute steering data bloom filter.
2020-06-26 16:02:09 -07:00
Jonathan Hui 2ebdf874eb [utils] remove wrap_string.h (#5150) 2020-06-25 09:14:18 -07:00
Abtin Keshavarzian 95679f1d83 [net-data-tlvs] update documentation and index parameter name style (#5148) 2020-06-24 21:03:51 -07:00
Abtin Keshavarzian d787ad0a95 [dtls] remove unused method decelerations (#5147) 2020-06-24 21:03:06 -07:00
Moandor 1cd9bb3074 [test] add expect tests for dataset and networktime (#5145) 2020-06-24 12:48:03 -07:00
Jonathan Hui 6e80c8b058 [tests] add test for prefix without on-mesh flag set (#5116) 2020-06-23 18:01:20 -07:00
Jonathan Hui 95a434d737 [slaac] set plen to 128 if prefix is not on-mesh (#5116) 2020-06-23 18:01:20 -07:00
Jonathan Hui 15c3463cec [tests] fix prefix configuration in 5_6_05 and 5_6_06 (#5116)
Prefix 3 should be configured as on-mesh.
2020-06-23 18:01:20 -07:00
Jonathan Hui 6897dffb57 [network-data] fix IsOnMesh() to check on-mesh flags (#5116) 2020-06-23 18:01:20 -07:00
Jintao Lin 474cd5fd86 [posix] Backwark compatible with older RCP image (#5139) 2020-06-23 13:41:23 -07:00
Jeff Bumgardner 4975681a97 [docker] build ot-daemon/ot-ctl in codelab_otsim (#5115)
Also remove wpantund from codelab_otsim.
2020-06-23 13:38:25 -07:00
Abtin Keshavarzian b17327456c [spinel] fix use of OT header file in spinel.c (#5141)
`spinel.h` and `spinel.c` are soruce files that may be used by host
side drivers and therefore the souurce code itself should not use any
of OT header files. Spienl file provide `SPINEL_PLATFORM_HEADER` to
allow platform to add their own includes if they want to.
2020-06-23 13:36:43 -07:00
Jintao Lin 5c722a770c [simulation] support transmit security at simulation radio (#5118)
This commit adds transmit security support for simulation radio so
that security Enh-ACK could be handled at radio layer. This commit
also fixes issue #5041.
2020-06-22 12:23:16 -07:00
Abtin Keshavarzian 4e1a3bf670 [tasklet] use function reference (instead of pointer) for tasklet handler (#5136) 2020-06-22 11:23:20 -07:00
Moandor ede592918c [test] add expect tests for sntp, mac, netif, and more (#5140)
Also does some minor enhancements.
2020-06-22 10:11:55 -07:00
Bob MacDonald a6116725c0 [efr32] remove extra parenthesis causing compilation problems (#5135)
Remove extra parenthesis introduced with commit b66ac5d causing
compilation error for all efr32mg builds.
2020-06-22 10:09:41 -07:00
Abtin Keshavarzian d6f2a155fc [ncp] ensure JOINER_STATE is not limited to FTD only (#5129)
This commit fixes the entry for getter in `ncp_dispacther` for spinel
`SPINEL_PROP_MESHCOP_JOINER_STATE` ensuring it is available in MTD
build as well as FTD when joiner feature is enabled.
2020-06-20 18:39:47 -07:00
Yakun Xu a344fb5969 [style] remove c++11 check and OT_NCP_CONST (#5132) 2020-06-20 18:11:12 -07:00
Yakun Xu f79406418a [android] enable commissioner (#5128) 2020-06-20 18:09:53 -07:00
Abtin Keshavarzian 53d23b511d [core] use C++11 static_assert (#5127)
This commit uses C++11 `static_assert()` replacing the existing
`OT_STATIC_ASSERT()` macro definitions (intended to support build-time
assertion in C++003 (oder) tool-chains).
2020-06-20 18:09:14 -07:00
Moandor 0cf84da100 [test] add expect tests for channel, coex, and discover (#5123) 2020-06-19 16:53:19 -07:00
Yakun Xu 8248c3d9df [posix] use real time signal for microsecond timer (#5122) 2020-06-19 16:12:55 -07:00
Yakun Xu b66ac5d907 [logging] remove NCP_SPINEL output (#5104)
This commit removes log output NCP_SPINEL and update the original log
output APP to use NCP_SPINEL behavior.
2020-06-19 10:02:53 -07:00
Abtin Keshavarzian c4fd7df086 [logging] add OPENTHREAD_CONFIG_LOG_MESHCOP (#5124)
This commit adds `OPENTHREAD_CONFIG_LOG_MESHCOP` which enable
MeshCoP modules logging. This replaces the use of MLE log config
`OPENTHREAD_CONFIG_LOG_MLE` for controlling MeshCop logging.

The makefiles are also updated to include the new config when
"FULL_LOGS" option is used.
2020-06-19 09:49:38 -07:00
Jiacheng Guo 8367f885ea [simulation] remove linux specific prctl (#5126)
These code is not used since we remove OPENTHREAD_TARGET_DEFINES in
examples/ in 2016.
2020-06-19 08:55:51 -07:00
Jiacheng Guo 5c13cec30b [posix] only update timeout with a lower value (#5119) 2020-06-18 20:27:14 -07:00
Simon Lin 2399220cc5 [otns] allow build without JOINER=1 (#5120) 2020-06-18 19:54:04 -07:00
Moandor 7574cde264 [cmake] fix error messages on macOS (#5117)
- check version of unifdef

- rename mbedtls-config.h to openthread-mbedtls-config.h to enable
  in-source build
2020-06-18 19:36:19 -07:00
Abtin Keshavarzian 96509d36ec [commissioner] prefer entry with Joiner ID match over one accepting any (#5110)
This commit includes a group of smaller enhancements in commissioner
module:

It adds `FindBestMatchingJoinerEntry()` which finds the best matching
joiner entry preferring an entry with full Joiner ID match over an
entry accepting any joiner.

`AddJoiner()` is changed to first try to find and update an existing
entry matching the given EUI64 before allocating a new entry. This
change in turn removes the need to call `RemoveJoiner()` from
`AddJoiner()` and the use of `JoinerOpFlag` to skip notifying the
leader from the unnecessary remove.

This commit also simplifies updating of joiner expiration timer,
changes the `SendCommissionerSet()` to be `void` (to avoid
`IgnoreError()`), adopts the use of `Ip6::InterfaceIdentifier` type to
store Joiner IID, and adds method `LogJoinerEntry()` to help with
logging of Joiner List updates.
2020-06-18 19:34:01 -07:00
Simon Lin a3860d6036 [size-report] retry multiple times (#5111) 2020-06-18 14:48:25 -07:00
Jonathan Hui 1326d64a64 [style] replace NULL with nullptr (#5109) 2020-06-17 22:44:54 -07:00
Yakun Xu 3b362071e5 [link-raw] set receive done callback when enabled (#5108) 2020-06-17 14:42:39 -07:00
Simon Lin f5d7f50f44 [tests] ignore otError in spinel tests (#5093) 2020-06-17 10:48:01 -07:00
Abtin Keshavarzian 55785040c9 [discover-scanner] allow filtering based on a user given bloom filter indexes (#5075)
This commit enhances the filtering behavior of Discover Scan. When
filtering is enabled, MLE Discovery Responses with steering data
(bloom filter) not containing a set of bloom filter indexes are
filtered. This commit updates the `DiscoverScanner::Discover()` to
allow filter indexes used for filtering to be optionally specified by
the caller. It can be set to NULL (for default behavior) where the
hash of factory-assigned EUI64 of the device would be used to derive
the bloom filter indexes
2020-06-17 10:38:03 -07:00
Abtin Keshavarzian 6094db2b96 [toranj] enhance discover scan test - cover filtering, channel-mask (#5075)
This commit enhances `test-005-discover-scan` to cover discover
scan over subset of channels, PAN ID filtering, and joiner only,
bloom filter scan behavior.
2020-06-17 10:38:03 -07:00
Abtin Keshavarzian 54ad5a3960 [discover-scanner] adding Mle::DiscoverScanner (#5075)
This commit adds new class `DiscoverScanner` which implements the MLE
Discover Scan process (moving and simplifying all the code related to
this from `Mle` and `MeshForwarder` into same file/class).
2020-06-17 10:38:03 -07:00
Jintao Lin e653478c50 [posix] get time offset between host and rcp (#5089)
To support CSL on RCP mode, POSIX host needs to know current time on
RCP. This commit adds function to periodically calculate the time
offset between host and RCP so that host can get an estimated RCP time
by adding its current time with this offset.
2020-06-16 22:53:29 -07:00
Moandor 0db8dbeef3 [cmake] generate a mbedtls-config.h without private headers (#5084) 2020-06-16 21:56:15 -07:00
Jonathan Hui d81d769e68 [style] advance C++ language standard to C++11 (#5077) 2020-06-16 13:02:53 -07:00
Simon Lin b50f33365c [github-actions] fix version workflow's name (#5103) 2020-06-16 08:55:10 -07:00
Moandor 5ec3848005 [test] add expect tests for macfilter, childip, version (#5107) 2020-06-16 08:53:37 -07:00
Abtin Keshavarzian bbb77b7658 [encoding] add uint64_t read/write methods for big/little endian encodings (#5105) 2020-06-16 08:51:30 -07:00
Simon Lin 9488d4bc48 [settings] fix DUA logging (#5095) 2020-06-15 21:29:50 -07:00
Markus Becker bad53a2e95 [ip6-address] add a type flag to addresses (#5019)
Add a origin flag to addresses so that applications are able to behave
differently on the type of address (System, SLAAC, DHCPv6, Manual).

Bumping OpenThread API version number.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-15 18:24:14 -07:00
Marvin ROGER ae4dfca5dd [posix] fix build errors on macOS (#5101)
This commit fixes 3 implicit conversion changes signedness errors,
when trying to build the posix core in daemon mode on darwin.
2020-06-15 18:12:48 -07:00
Simon Lin 44f1a8bf29 [tests] use longer timeouts for simulation tests (#5094)
* use longer duration for pexpect and socket
* use 10s timeouts
2020-06-15 18:11:34 -07:00
Jeff Bumgardner 79c564fc6e [docs] add English source for the Thread Primer (#5088) 2020-06-15 11:41:55 -07:00
Marvin ROGER 8856ce132d [bootstrap] add missing newlib on Ubuntu >= 20.04 (#5100) 2020-06-15 11:15:30 -07:00
Moandor 4910f91e8c [test] add expect tests for ipmaddr, neighbor, leaderdata (#5097) 2020-06-15 10:19:08 -07:00
Steven Cooreman 30f40fc0fa [efr32] turn off warnings which break certain configurations of mbed TLS (#5091)
Detected on EFR32MG21 with hardware acceleration turned on, all inside
mbedTLS' library/ecdsa.c:

* Turning on ECDSA signing acceleration (MBEDTLS_ECDSA_SIGN_ALT)
  triggers an unused parameter on rs_ctx in
  mbedtls_ecdsa_write_signature_restartable

* Turning on ECDSA verification acceleration
  (MBEDTLS_ECDSA_VERIFY_ALT) triggers an unused parameter on rs_ctx in
  mbedtls_ecdsa_read_signature_restartable

* Turning on both ECDSA signing & verification acceleration
  (MBEDTLS_ECDSA_SIGN_ALT + MBEDTLS_ECDSA_VERIFY_ALT) triggers an
  unused function error on static function derive_mpi

Looking at the latest mbed TLS development branch, it seems this issue
will not be resolved soon. Therefore, we're turning off warnings for
unused parameters and unused functions inside mbedTLS for the platform
which uses this configuration (EFR32MG21).
2020-06-12 10:32:35 -07:00
Simon Lin 9aadfd0cdf [script] install shellcheck in bootstrap (#5067) 2020-06-11 18:26:18 -07:00
Steven Cooreman 29bcfee0df [efr32] update mbedTLS configuration to use more hardware acceleration (#5074)
Turns on the following:
* SHA256 acceleration on all EFR32 devices (used for SHA256,
  HMAC-SHA256, ECDSA and DRBG)
* ECDSA/ECDH acceleration on EFR32MG21 (used in DTLS and exposed to
  application through otCryptoEcdsaSign)
* AES-CCM acceleration on EFR32MG21 (in case OT is updated to take
  advantage of mbedTLS' AES-CCM API)
* AES-CMAC acceleration on EFR32MG21 (used for PBKDF2)

Awaiting new GSDK release:
* end-to-end EC-JPAKE acceleration on EFR32MG21 (used in DTLS)
2020-06-11 15:53:05 -07:00
Simon Lin 7f3013cb06 [posix] fix ot-ctl CLI output missing (#5087)
An issue occurs when ot-ctl reads the CLI output in multiple chunks in
which the last line of a chunk does not ends with a '\r\n'. The last
line is then dropped incorrectly.

This commit fixes this issue:

- Output the last line (without \r\n) if it's not ">" (have to drop
  '>' because we can not determine whether or not to output '>')

- Output ">" if the first char is not ' ' but the previous promptState
  is 1 (meaning '>' was dropped previous but should have been
  printed).
2020-06-11 11:29:21 -07:00
Jonathan Hui 2c258a3f3e [network-data] in Validate() only check dups against prior prefixes (#5083)
To avoid buffer overrrun issues.
2020-06-11 10:25:53 -07:00
Simon Lin 8e124e6fac [cert] capitalize python class constants (#5080)
According to PEP8, constants should be written in all capital letters.

This commit capitalizes these constants:
- thread_cert.TestCase.topology
- thread_cert.TestCase.support_ncp
2020-06-10 18:14:59 -07:00
Abtin Keshavarzian 0ad3c20747 [mle-tlvs] remove unused type/constant definitions (#5082) 2020-06-10 17:06:39 -07:00
Yakun Xu 55790fb960 [cmake] use ot-config to umbrella private includes (#5079)
- add include directories to ot-config
- remove unused OT_PRIVATE_INCLUDES
2020-06-10 17:03:49 -07:00
Jonathan Hui 71c0def4f8 [fuzz] fix undefined macro warning (#5076) 2020-06-10 06:34:19 -07:00
Abtin Keshavarzian 4f85283fb3 [toranj] allow verbose mode (on all nodes) to be enabled using env variable (#5078)
This commit adds additional mechanism in `toranj` to enable verbose
mode on all nodes by setting the env variable `TORANJ_VERBOSE` (this is
in addition to existing mechanism where verbose mode can be enabled
per node from a test script). When `TORANJ_VERBOSE` env is used to
enable verbose mode, it also enables OT logging on all nodes (OT logs
are collected in the `wpantund-logs<node_index>.log` files along with
`wpantund` logs). This commit also updates the `toranj/README.md` to
describe the new mechanism.
2020-06-10 06:33:56 -07:00
Moandor 4d1197a34a [test] split cli-2-nodes.exp into multiple files (#5066)
This splits cli-2-nodes.exp into multiple files each of which contains
tests for a single command.
2020-06-09 19:05:05 -07:00
Yakun Xu dce84a77fb [cmake] add posix in platform list (#5071)
- rename "none" to NO, which computes to false in if()
- sort platform names
- add "posix" into the platform list so that it can be selected from cmake-gui
2020-06-09 16:14:10 -07:00
Rongli Sun bc9745584b [dua] save dad counter into non volatile memory (#4904) 2020-06-09 12:39:22 -07:00
paragdixit-g ef0045a6dd [posix] fix otPlatAlarmMicroGetNow to use scaled time (#5070)
This makes it consistent with MilliGetNow() counterpart.
2020-06-09 12:34:44 -07:00
Jonathan Hui f36ad41c62 [meshcop] support get/set operational dataset via raw TLVs (#5055)
- Add CLI commands to get/set operational dataset using TLVs.
2020-06-09 11:53:13 -07:00
Jonathan Hui 5550a608d6 [fuzz] limit PBKDF2 iterations to avoid OSS-Fuzz timeout (#5069) 2020-06-09 10:47:37 -07:00
kangping 76b5270d8f [posix] fix spinel radio state transition (#5068) 2020-06-09 10:47:25 -07:00
kangping 8a1339a859 [meshcop] move Joiner::IsPskdValid() to MeshCoP::IsPskdValid() (#5065) 2020-06-09 10:45:27 -07:00
Rongli Sun b51d9100e6 [dua] support to specify iid for domain unicast address (#4900) 2020-06-09 10:38:13 -07:00
Yakun Xu b28d7c4a45 [test] split out 1.2 and posix from simulation (#5063)
This commit splits out 1.2 and posix workflows from simulation workflow
so that when an unstable job failed, just a few jobs need rerun.
2020-06-08 10:20:46 -07:00
Markus Becker 54f24c6074 [cmake] use the correct define for external heap (#5058)
In options.cmake OPENTHREAD_CONFIG_*EXTERNAL_HEAP*_ENABLE is used,
while in common-switches.mk and the source code the slightly different
OPENTHREAD_CONFIG_*HEAP_EXTERNAL*_ENABLE is used.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-08 10:19:37 -07:00
Abtin Keshavarzian f177acfc4a [notifier] add Notifier::Receiver (#5052)
This commit adds `Notifier::Receiver` class which is inherited by
OpenThread core types/classes to register themselves as a receiver
of `Notifier` events. This change helps simplify and replace the
previous `Notifier` callback model.
2020-06-08 10:17:52 -07:00
Abtin Keshavarzian adb57991e8 [notifier] add Event and Events types (#5052)
This commit adds `Event` enumeration type representing `Notifier`
events (mirroring `OT_CHANGED_{EVENT}` constants). It also adds
`Events` class which represents a collection of events. The `Events`
class provides helper methods to check whether a specific event has
happened, or whether any or all of a given subset of events are
present in the `Events` collection.

This commit also renames the `Notifier` handler method in different
core classes to `HandleNotifierEvents()`.
2020-06-08 10:17:52 -07:00
Abtin Keshavarzian 7ae409af65 [posix] rename struct Event to VirtualTimeEvent (#5052)
This `struct` is defined in a C header file and therefore it is not
scoped in a `namespae`. The rename is to avoid name conflicts with
OpenThread core definitions (allowing `ot::Event` to be defined).
2020-06-08 10:17:52 -07:00
Jing Ma 75e21adcec [harness-automation] add a parser tool for TopologyConfig file (#4975)
- parse TopologyConfig file in Thread Certification Test Harness
- list multi-vendor device numbers by case
- list needed vendor device numbers for the whole certification testbed
2020-06-08 10:15:59 -07:00
Yakun Xu fb39910402 [posix] fix build daemon mode (#5062) 2020-06-05 22:18:33 -07:00
Abtin Keshavarzian 5ef652b5aa [mle] simplify appending of MLE Discovery TLV in Mle::Discover() (#5059) 2020-06-05 22:17:47 -07:00
Moandor 4b5eeadee6 [test] modularize expect scripts (#5056)
This puts the scripts setting up Thread networks into separate files
so that they can be reused by multiple test scripts. After this we can
split the tests in cli-2-nodes.exp into multiple files without having
to repeat codes in each file.
2020-06-05 22:16:54 -07:00
Moandor 2e60748d5b [test] add expect tests for router, scan, and more (#5054)
- router
- scan
- parentpriority
- pollperiod
- prefix
- preferrouterid
- route
2020-06-05 12:40:59 -07:00
Jonathan Hui 616d8cb8a5 [cli] implement 'rcp version' command (#5051) 2020-06-05 12:24:54 -07:00
Abtin Keshavarzian 99a42ccadc [timer] use function reference (instead of pointer) as timer handler (#5050) 2020-06-05 12:24:28 -07:00
Yakun Xu 82053cc9db [tests] add dns client tests (#5049) 2020-06-04 13:24:43 -07:00
Yakun Xu 6a6cbe48f0 [posix] use os defined macros (#5048)
This helps the OT_ASSERT automatically adopt the posix provided assert.
2020-06-04 13:22:49 -07:00
Yakun Xu 61f24c70fb [radio-url] GetValue once and add missing doc (#5046) 2020-06-04 13:21:34 -07:00
Abtin Keshavarzian 1d9b705a48 [meshcop] adding SteeringData class (#5040)
This commit adds a new class `MeshCoP::SteeringData` which manages
the Steering Data and bloom filter generating and filtering. This
commit also adds a unit test `test-steering-data` for the newly
added `SteeringData` class.
2020-06-04 13:20:17 -07:00
Simon Lin 06025122c0 [posix] fix uart-baudrate argument of radio url (#5045) 2020-06-03 22:11:55 -07:00
Moandor ea7c76cc4b [test] add expect tests for pcap receiving (#5043)
This adds expect tests for testing the pcap receiving function of
promiscuous mode. Also makes otLinkSetPromiscuous be called before
otLinkSetPcapCallback so that the callback won't be set when
promiscuous mode fails to start.
2020-06-03 22:11:14 -07:00
Jintao Lin 201b7b1a3d [mac] move auxiliary frame counter from Mac to SubMac (#4976)
In Thread 1.2, it is possible to receive an IEEE 802.15.4-2015
packet. Per specification, receiver should acknowledge this packet
with an IEEE 802.15.4-2015 ACK(Enh-ACK). This Enh-ACK can include
header IE with it and requires security enabled bit in FCF be set to
true. It is impractical for the host to generate the Enh-ACK and send
to RCP for transmission within AIFS time(192us). So RCP should prepare
the Enh-ACK by itself, which requires it to fill in the frame counter
and do the encryption/authentication.

This commit tries to address the need of filling auxiliary frame
counter in RCP by including the following changes:

- Move frame counter related functions from MAC layer to SubMac layer,
  which is mirrored in RCP.

- Set mMacFrameCounter to RCP using newly added spinel properties.

- RCP reports last used frame counter to host in TxDone and RxDone.

- Add a simulation test for reset verification.
2020-06-03 22:09:16 -07:00
Abtin Keshavarzian 72c369ced3 [udp6] add method documentation for GetUdpSockets() (#5044) 2020-06-03 16:06:46 -07:00
Yakun Xu f302796bd2 [simulation] send enh-ack for 802.15.4-2015 frames (#5039)
This commit changes the simulation radio to send secured enh-ack for
secured frames. This improves code coverage for testing.
2020-06-03 10:59:19 -07:00
Yakun Xu 6de8d778b7 [tests] skip running expected fail tests (#5038)
This commit skips running expected fail tests so that it will be easier
to find real failures and saves some time.
2020-06-02 21:32:00 -07:00
Moandor ced3c08a04 [test] add expect tests for child (#5037)
This adds test cases for child command. Also moves ping tests with 2
nodes to cli-2-nodes.exp, future tests requiring 2 nodes will be
placed in this file.
2020-06-02 21:20:24 -07:00
Yaoxing Shan f0d07ae6d3 [bootstrap] remove PPA on Ubuntu 20.04 and later (#5009) 2020-06-02 21:17:15 -07:00
Jonathan Hui 0565f44a4c [mle] restore operational datasets when becoming leader (#5036)
The leader is authoritative in the operational datasets that it
distributes. This commit ensures that a device becoming a leader
restores the operational dataset from non-volatile. This ensures that
the operational datasets that the leader attempts to distribute are
the same as in its non-volatile storage.
2020-06-02 13:37:54 -07:00
Yakun Xu aa19e77ac7 [continuous-integration] add version number check (#5034) 2020-06-02 13:37:42 -07:00
Abtin Keshavarzian 1ce2a07afd [core] add Clearable class providing simple Clear() method (#5029)
This commit adds new class `Clearable` (inherited by other types)
providing simple implementation of `Clear()` which sets all the
instance bytes to zero (using `memset()`).
2020-06-02 13:36:24 -07:00
Abtin Keshavarzian 71575ff76a [core] add Equatable class providing overloads of == and != operator (#5029)
This commit adds new class `Equatable` (inherited by other types)
providing overloads of operators `==` and `!=`. The implementation
simply compares all the bytes of two instances of same type to be
equal (using `memcmp`).
2020-06-02 13:36:24 -07:00
Yakun Xu 2b9e8facba [test] cover micro timer in unittest (#5030) 2020-06-01 22:05:42 -07:00
Li Cao 70f2e54d06 [low-power] encapsulate method to update header IE (#4999)
OpenThread currently implements a TIME_SYNC IE. The presence of IEs
also affects the frame version and IE present field. This commit
encapsulates the process to update these things so that it could be
easily extended to support other IEs that are introduced later.
2020-06-01 21:59:01 -07:00
Li Cao b9d348c328 [simulation] use ACK frame generation utils (#5033) 2020-06-01 17:06:02 -07:00
Yakun Xu ba0b896b20 [continuous-integration] use apt-get instead of apt (#5032)
This commit changes apt to apt-get for the WARNING in build logs:

WARNING: apt does not have a stable CLI interface. Use with caution in
scripts.
2020-06-01 17:03:33 -07:00
Yakun Xu 075c46c7b5 [ot-ctl] no output prompt in non-interactive mode (#5026) 2020-06-01 16:59:19 -07:00
Jonathan Hui dfd022e1a4 [ip6] forward any packet with on-mesh destination. (#5024)
Existing implementation only looks at addresses configured on the
network interface to determine what prefixes are on-link (on-mesh for
Thread). When the network interface does not have an assigned address
for a given on-mesh prefix, any packet with that on-mesh prefix will
not be forwarded to the Thread network.

This commit also checks the destination address against Thread's set
of on-mesh prefixes, independent of whether addresses out are assigned
out of the on-mesh prefix.
2020-06-01 09:48:15 -07:00
Yakun Xu f8f75d6d05 [posix] clean up for radio url (#5027)
* fix max-power-table documentation
* rename `baudrate` to `uart-baudrate`, `arg` to `forkpty-arg`
* update command line enumeration
* update README
* remove trailing argument from node.py
2020-06-01 08:13:46 -07:00
Jiacheng Guo 115616c6bf [posix] add radio url (#4935)
Radio url provides a unified interface for users to specify the radio
peripheral device and arguments to the OpenThread core stack.
2020-05-29 17:34:29 -07:00
Jonathan Hui b0b2591bc0 [mle] fix bug in leader active/pending dataset synchronization (#5021)
The leader is the authoritative source when propagating active/pending
operational datasets. When the leader reboots, it is possible for the
leader to become out-of-sync. In particular, after the leader resets,
it restores its network data and active/pending operational datasets
using MLE Data Request/Response to retrieve them from a neighboring
device. If the neighboring device has an older active/pending
operational dataset, the leader will retrieve the older datasets and
never attempt to propagate the newer datasets that it may have stored
locally.

This commit makes the following changes:

- The leader does not accept any changes to the active/pending
  operational datasets.

- After retrieving the latest network data from a neighboring device
  (as part of resynchronizing after reset), the leader will increment
  the full and stable network data versions to ensure that the leader
  propagates the latest active/pending operational datasets.
2020-05-29 17:01:46 -07:00
Rongli Sun 46305be082 [script] echo RADIO_PTY properly (#5023) 2020-05-29 10:40:00 -07:00
Zhanglong Xia c5aff31327 [cmake] add a cmake build script to build OpenThread (#4969)
This commit adds a bash script to compile the platform that supports
cmake.

Usage examples:
    ./script/cmake-build cc1352
    ./script/cmake-build posix -DOT_MAC_FILTER=ON
2020-05-29 08:33:50 -07:00
Moandor f6956dfcc9 [test] add various CLI command tests (#5017) 2020-05-29 08:31:58 -07:00
Abtin Keshavarzian 456cdf3091 [mle] add constant kMleSecurityTagSize for MLE security tag size (#5015) 2020-05-28 22:02:22 -07:00
Abtin Keshavarzian 19e2d148a1 [ecdsa] use reference (instead of pointer) for output length (#5015) 2020-05-28 22:02:22 -07:00
Abtin Keshavarzian 615bf36d88 [crypto] update method documentation and style (#5015) 2020-05-28 22:02:22 -07:00
Abtin Keshavarzian f640774684 [aes-ccm] misc enhancements (#5015)
- add a new enumeration type `Mode` to indicate the encryption vs.
  decryption mode in `AesCcm::Payload()` method.
- add `GetTagLength()` method and simplify `Finalize()`.
- change `AesCcm::Init()` to assert on bad tag length input param
  instead of returning `OT_ERROR_INVALID_ARGS`.
- reorder AesCcm member variable to help with alignments
- use CHAR_BIT
- remove check of tag length from Finalize
- use `memcpy`/`memset` to copy/clear buffers
2020-05-28 22:02:22 -07:00
Yakun Xu 72717f5178 [api] add a monotonic version number (#5012) 2020-05-28 22:01:33 -07:00
Abtin Keshavarzian 752ad977db [tlvs] add ReadTlv (ReadUint8Tlv, etc) helper methods (#5008)
This commit adds new helper static methods in `Tlv` class to read a
(simple) TLV in a `Message` at a given offset. The TLV's value can be
an `uint` type or a fixed length data blob. These methods are used
in ML and network-diagnostics modules, and also internally by other
`Tlv` class methods.
2020-05-28 15:23:23 -07:00
Abtin Keshavarzian 46eb55bb09 [tlvs] change Tlv::AppendTlv value param to be void pointer (#5008)
This commit changes the `Tlv::AppendTlv()` value parameter to use
`void *` as its type. This helps simplify its used in different
modules (we can simply pass a pointer to the object that is to be
appended as the TLV's value and avoid casting or conversion to
`uint8_t *`).
2020-05-28 15:23:23 -07:00
Abtin Keshavarzian 8b387c5fb4 [tlvs] rename helper methods to FindTlv (FindUint8Tlv, etc) (#5008)
This commit renames the helper `static` methods in `Tlv` class. It
harmonizes the naming model to use `FindTlv()` for different flavors
of methods that search within a given `Message` (or buffer) to find a
TLV with a given type. This commit also removes the re-definition of
same `static` methods in sub-classes of `Tlv` class. This helps
simplify the use of such methods and avoids the shadowing of some
flavors of methods  due to their re-definition in the sub-class (the
sub-class re-definition allows a more specific TLV `Type` enumeration
parameter to be used, however the base case version will continue to
work due to implicit conversion of `enum` value to an integer).
2020-05-28 15:23:23 -07:00
Simon Lin 578b29fa60 [thci] fix address filter code issues (#4986)
This commit fixes existing issues in address filters.

- Fix misuse of address filter modes
  - disabled should be disable
  - Whitelist should be whitelist
  - Blacklist should be blacklist
- Fix errors in removing macfilter entries

Impact on 1.1 certification:

This commit does not impact 1.1 certification because only
OpenThread_WpanCtl.py is changed. In 1.1 certification, all golden
devices are controlled by OpenThread.py. OpenThread_WpanCtl.py is used
to control OTBR DUT, and mac filter feature is not useful for a
DUT.
2020-05-28 11:23:00 -07:00
Yakun Xu 8b904a30e6 [github-actions] split toranj into a separate workflow (#5016)
This commit split toranj tests into a separate workflow so that we can
re-run it only when it fails.
2020-05-28 10:52:17 -07:00
Yakun Xu 23ed067d68 [cmake] make ot-config private (#5014) 2020-05-28 10:36:59 -07:00
Jiacheng Guo 52f4125558 [posix] fix state changed chandler filter logic (#5013) 2020-05-28 10:35:57 -07:00
Yakun Xu 5e65833d72 [ot-ctl] fix reset in non-interactive mode (#5011)
* set close on exec
* explicitly close socket on reset
* enhance ot-ctl to exit on peer close
* added test for the change
2020-05-28 10:31:16 -07:00
Jing Ma 204308f4a7 [harness-automation] fix browser stuck in navigating to url (#5005) 2020-05-27 22:43:57 -07:00
Yakun Xu 50cfda10b1 [script] install shfmt (#4989)
This commit installs shfmt in script/bootstrap.
2020-05-27 16:12:22 -07:00
rob-the-dude 034f89d824 [posix] some platforms don't support MSG_NOSIGNAL (#4996)
On platforms that have SO_NOSIGPIPE, use that to achieve the same result.

On platforms that have neither, emit a compile-time warning -- you may
still receive the signal on those systems.
2020-05-27 13:08:36 -07:00
Jonathan Hui 958c3c12e5 [docker] remove wpantund from environment image (#5006) 2020-05-27 12:47:50 -07:00
Moandor 75a382d292 [cli] fix argument parsing for counters command (#5004)
This fixes the argument parsing for counters command. The lines
calling otLinkResetCounters and otThreadResetMleCounters are
unreachable and this fixes it.
2020-05-26 10:26:34 -07:00
Yakun Xu 9a3c2dc3b3 [cmake] add ot-config (#5003)
This commit adds an interface target ot-config for collecting compile definitions.
2020-05-26 10:24:22 -07:00
Yakun Xu dd1be49d5f [script] suppress GitHub Actions check annotations (#5001) 2020-05-26 10:21:14 -07:00
Li Cao cdd62370d6 [continuous-integration] add github action to run 1_2 with clang (#4993) 2020-05-26 10:18:12 -07:00
Piotr Koziar d281be6aef [build] change underscore to dash in libmbedcrypto name (#5002) 2020-05-25 17:17:18 -07:00
Yakun Xu 3bc67ee6f9 [posix] get node id from command line argument (#5000)
This simplify manually running posix virtual time mode when debugging.
2020-05-25 16:03:27 -07:00
Philipp-Wohlgenannt-Tridonic-com 7942b00eee [cmake] add NCP vendor hook option from Zephyr (#4983)
Signed-off-by: Philipp Wohlgenannt <philipp.wohlgenannt@tridonic.com>
2020-05-25 15:58:06 -07:00
rob-the-dude 657b4cb291 [cli] add command for getting the network interface name and index (#4985)
* add a CLI command for getting the network interface name and index

On some platform (mostly BSDs), we do not have the option to specify
the tunnel name, although most of those platforms do have a way to dynamically
obtain a unique interface name if desired.  Add a CLI command -- only enabled
on platforms that have PLATFORM_NETIF enabled -- that will return the
name of the tunnel interface, as well as it's index.  Both are useful in doing
automated tests on non-Linux systems.

* remove OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE from the "check" scripts

This option really only applies to the POSIX "management" applications
(ot-daemon, ot-ctl), and not to the core radio or simulation component
builds (ot-cli, etc).

My other change adds a command ("netif") that is only useful when the
netif code is enabled, and that only happens when the netif code is linked,
which is only in those "management" utilities.  Turning this setting off
allows the tests to pass, with no impact to the functionality previously
tested.  But if this setting remains on, then my new code creates a
dependency that cannot be resolved outside the management applications.
2020-05-21 21:58:29 -07:00
Jiacheng Guo 12ac7d2730 [posix] tolerate SIGPIPE under daemon mode (#4994)
Chances are that the ot-ctl client exits between read error check and
write. This will lead to a SIGPIPE crash. We can ignore this signal and
check the error code instead.
2020-05-21 16:52:51 -07:00
Abtin Keshavarzian 875a945123 [network-diagnostic] fix parsing of Type List TLV in HandleDiagnosticReset() (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian 582c2c136a [network-diagnostic] skip unrecognized TLV type in FillRequestedTlvs() (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian ec1ba12dfd [network-diagnostic] use Tlv helper methods to append simple TLVs (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian 6ad88b49ab [network-diagnostic] simplify GetNextDiagTlv() implementation (#4992)
This commit simplifies the implementation of `GetNextDiagTlv()` by
skipping unrecognized TLVs from `default` case and jumping to top of
the loop for a next TLV, and adding a common `ExitNow()` at the end of
`switch()` statement to handle when a TLV is found and successfully
parsed. This change helps remove the need for `OT_UNREACHABLE_CODE()`
use.
2020-05-21 12:05:13 -07:00
Abtin Keshavarzian f0df3e3d6b [network-diagnostic] add Iterator type (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian c90f5f3f3e [network-diagnostic] add method documentation for GetNextDiagTlv (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian c4faeea067 [network-diagnostic] update GetNextDiagTlv() parameter to use Message (#4992) 2020-05-21 12:05:13 -07:00
Abtin Keshavarzian 8160f3423b [message] adding Message::Settings (#4977)
The `Message::Settings` mirrors `otMessageSettings` and is used
when allocating a new `Message`.
2020-05-20 22:57:56 -07:00
Abtin Keshavarzian 17a0405c51 [message] add Message::Priority enumeration type (#4977) 2020-05-20 22:57:56 -07:00
Abtin Keshavarzian 6c0b9214d8 [message] add Message::SubType (#4977) 2020-05-20 22:57:56 -07:00
Abtin Keshavarzian 2b613be823 [message] add Message::Type (#4977) 2020-05-20 22:57:56 -07:00
Abtin Keshavarzian 66afc9a969 [message] add helper methods to get Message Metadata (#4977)
This commit renames the message metadata to `MessageMetadata` and
adds helper method `Buffer::GetMetadata()` to get the metadata.
2020-05-20 22:57:56 -07:00
Abtin Keshavarzian ff30eddfdb [message] update Buffer and MessagePool to use LinkedList methods (#4977) 2020-05-20 22:57:56 -07:00
Abtin Keshavarzian dd5c9d3cac [message] update method decelerations, add documentation (#4977) 2020-05-20 22:57:56 -07:00
Li Cao 903ea67505 [mac-frame] fix problems to generate enh ack (#4990)
- Existing code assumes security is always enabled in enhanced ack,
  however that's not always the case. So add security part only when
  it's required.

- FindHeaderIeIndex would return kInvalidIndex when IE is not
  present. It's possible that no IE is in an enh ack, so use
  SkipSecurityHeaderIndex instead.
2020-05-20 22:43:59 -07:00
Simon Lin c2126a392f [cmake] add long routes options (#4859) 2020-05-20 21:02:25 -07:00
Simon Lin bdfafb437e [github-actions] add test to verify OTNS works (#4847) 2020-05-20 20:34:19 -07:00
Simon Lin 99e0666082 [mle] fix MLE Router handling errors (#4860) 2020-05-20 20:22:15 -07:00
Moandor a142b4234c [test] add expect tests for extaddr, ping, promiscuous (#4954) 2020-05-20 19:37:50 -07:00
Jing Ma 25d90c7f92 [mac] count out-of-band Tx frames (#4936) 2020-05-20 19:37:05 -07:00
Moandor 93c55f5837 [continuous-integration] remove git clean in scripts (#4988)
This removes the use of `git clean` in scripts to prevent accidental
loss of work.
2020-05-20 17:55:50 -07:00
Simon Lin fa96bcd10f [otns] allow virtual time UART (#4818) 2020-05-20 17:52:36 -07:00
Jonathan Hui 2485f72d15 [meshcop] do not send MGMT_*_SET.req while one is outstanding (#4981)
This commit helps ensure the following:

- At most one MGMT_ACTIVE_SET.req message is outstanding.

- At most one MGMT_PENDING_SET.req message is outstanding.
2020-05-20 14:27:41 -07:00
Yakun Xu 883d32356f [posix] ot-cli be indepedent of openthread-ncp-ftd (#4953) 2020-05-20 11:30:23 -07:00
Yakun Xu 31e600f227 [cmake] allow just build NCP/CLI/RCP (#4953) 2020-05-20 11:30:23 -07:00
Moandor c3e7fdc83e [instance] disable instance member copying (#4973) 2020-05-19 22:07:06 -07:00
rob-the-dude 86369858f7 [posix] allow configuration of macOS tunnel driver selection outside of code (#4980)
In order to enable automated testing of mac OS, we're likely to need
the ability to build for utun instead of tun, so make that option
configurable via external options, and make the default utun, which
will be easier for most developers to use (the caveats are documented
in netif.cpp).
2020-05-19 17:26:26 -07:00
Jonathan Hui dd0fa0d34c [shell] resolve shellcheck warnings (#4966) 2020-05-19 13:04:42 -07:00
Jonathan Hui cb9b353fb3 [scripts] apply shfmt changes (#4966) 2020-05-19 13:04:42 -07:00
Jonathan Hui 916023b6e7 [pretty] add support for shell (#4966) 2020-05-19 13:04:42 -07:00
Simon Lin 8dbc0d9605 [test] fix python issues in tests (#4960) 2020-05-19 10:31:50 -07:00
kangping 154958aab9 [tests] fix wrong whitelist filter in commissioning tests (#4933)
This commit fixes the problem that `whitelist` is not enabled in
commissioning test cases which results in false pass of `Cert_8_2_01`
and `Cert_8_2_02`.

Without this commit, `Cert_8_2_01` and `Cert_8_2_02` will fail if we
turn on `whitelist`, because we now use random extaddress for
discovery requests.
2020-05-19 10:30:11 -07:00
rob-the-dude 6adfa966e0 [posix] two fixes for macOS and FreeBSD (#4979)
First, deal with the C++ crankiness about a structure defined inside
another structure, but make sure we don't get tripped up if the SDK
ever changes.

Second, macOS should not be using the IN6_IFF_NODAD, as rather than
avoiding DAD, it actually makes addresses remain in the "tentative"
state indefinitely.
2020-05-18 16:43:02 -07:00
rob-the-dude 730b94f4f7 [posix] allow compilation on FreeBSD (#4978) 2020-05-18 16:34:02 -07:00
Yakun Xu 7d1934202f [cmake] add ncurses dependency (#4971)
This is required on OpenWRT.
2020-05-18 09:36:55 -07:00
Jonathan Hui 132ba9d3fb [continuous-integration] add build checks for jn5189 and k32w061 (#4968) 2020-05-18 09:36:00 -07:00
Abtin Keshavarzian 436aba64c0 [mac] adding otMacKey and Mac::Key (#4967)
This commit adds a new type `otMacKey` which represents a MAC security
key (used by AES-CCM to perform frame security) and core subclass of
this as `Mac::Key`. The same type is used as `Mle::Key`. The
`KeyManager`, `Mac`, `Mle`, and other modules are updated to use the
new `Key` types. The public OT API `otLinkRawSetMacKey` and radio
platform `otPlatRadioSetMacKey()` are also updated to use `otMacKey`.
2020-05-18 09:35:45 -07:00
Łukasz Duda 72109da6f1 [nrf52833] use 2 flash pages for non-volatile memory by default (#4972) 2020-05-15 10:18:49 -07:00
Moandor 3d870fc312 [channel-monitor] remove channel monitor copying (#4970)
This removes the copying of `ChannelMonitor` in
`otChannelMonitorSetEnabled`, so channel monitor enable/disable can work.
2020-05-15 10:01:45 -07:00
Simon Lin 7a3b52ed87 [codecov] only comment after a number of builds (#4961) 2020-05-15 10:00:23 -07:00
doru91 3122132af8 [examples] add k32w061 platform (#4930) 2020-05-14 14:19:25 -07:00
Łukasz Duda 09dd07d823 [ip6] do not pass reassembled IPv6 packet to the host (#4964)
When Border Router is built with `OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE`
flag and receives the message to its Mesh-Local EID, for a small range of IPv6
lengths, NCP may forward both IPv6 fragments and reassembled packet. This commit
ensures the latter situation does not happen.
2020-05-14 10:29:12 -07:00
Duda, Lukasz 495f76571f [coap] ensure CoAP control messages are prioritized (#4962) 2020-05-14 09:09:17 -07:00
Duda, Lukasz 7edb455330 [icmp6] ensure ICMPv6 error messages are prioritized (#4962) 2020-05-14 09:09:17 -07:00
Jiacheng Guo 3e1bf97188 [posix] return INVALID_STATE on EINVAL (#4959)
After adding and removing addresses, sendmsg call will return EINVAL for
a short period of time. Return INVALID_STATE to inform callers to try
again later.
2020-05-14 09:01:34 -07:00
kangping 092eb186e1 [joiner] add validation of joiner PSKd (#4934) 2020-05-14 08:41:51 -07:00
Yakun Xu aa1b2927c8 [diag] check RCP diag commands (#4955) 2020-05-13 18:10:14 -07:00
Li Cao e3acd17466 [config] change macro define names for CSL feature (#4958) 2020-05-13 14:40:49 -07:00
Abtin Keshavarzian a272835196 [mle-tlvs] fix method documentation (#4956) 2020-05-13 10:22:39 -07:00
Zhanglong Xia 39567513eb [nrf528xx] add OT_UNUSED_VARIABLE to avoid compiler warning (#4951)
When the macro `SPIS_AS_SERIAL_TRANSPORT` is enabled,
`UART_AS_SERIAL_TRANSPORT` and `USB_CDC_AS_SERIAL_TRANSPORT`
are disabled, no one uses the argument `aPseudoReset`. The
compiler generates a warning.
2020-05-13 10:16:57 -07:00
Jonathan Hui 03d65251cb [message] change MoveOffset() to return void (#4949) 2020-05-13 10:16:19 -07:00
Jonathan Hui 1ce5064832 [message] change SetOffset() to return void (#4949) 2020-05-13 10:16:19 -07:00
Jintao Lin 2afbc59293 [mac] put transmission AES-CCM* to SubMac layer (#4919)
In Thread 1.2, it is possible to receive an IEEE 802.15.4-2015
packet. Per specification, receiver should acknowledge this packet
with an IEEE 802.15.4-2015 ACK(Enh-ACK). This Enh-ACK can include
header IE with it and requires security enabled bit in FCF be set to
true. It is impractical for the host to generate the Enh-ACK and send
to RCP for transmission within AIFS time(192us). So RCP should prepare
the Enh-ACK by itself, which requires it to fill in the frame counter
and do the encryption/authentication. This commit tries to address the
need of transmission security/authentication by including the
following changes,

- Move Key ID mode 1 AES-CCM* related functions from MAC layer to
  SubMac layer, which is mirrored in RCP.

- Distribute the MAC key and MAC key ID to RCP in posix app using
  newly added spinel properties.

- Make it possible for radio(either in radio driver or hardware) to do
  transmission AES-CCM* if the platform supports by adding radio
  capability OT_RADIO_CAPS_TRANSMIT_SEC.

- Enable this for RCP mode on simulation platform.
2020-05-13 10:15:39 -07:00
Li Cao cd9558ca91 [mac-frame] add util functions to generate ack (#4884)
This commit adds mac frame util functions to generate acks (both Imm
and Enh acks) from a received frame. These funtions are utils APIs for
platforms which don't provide ack generation.

This commit also introduces compile options for CSL to control the CSL
IE related part.
2020-05-12 22:20:03 -07:00
Zhanglong Xia 8e84e05429 [posix] fix inconsistent function definitions issue (#4950)
The arguments of the funtion `otPlatDiagProcess` in posix radio driver
is different from the one defined in the `diag.h`. It causes the diag
module uses the weak definition of the function `otPlatDiagProcess`.
This commit fixes this issue.
2020-05-12 18:03:32 -07:00
Moandor b4a5df49e6 [continuous-integration] enable most features on build check (#4946) 2020-05-11 16:45:38 -07:00
Abtin Keshavarzian 1016a5425b [toranj] add new test to verify lowpan fragmentation (#4945)
This commit adds a new test to verify 6LoWPAN fragmentation logic by
exchanging IPv6 messages with many different lengths between two
nodes.
2020-05-11 15:23:58 -07:00
Abtin Keshavarzian 48086040b7 [mesh-forwarder] allow last 6LoWPAN fragment to use longer length (#4945)
This commit relaxes the length check for the last 6LoWPAN fragment of
a message. The length of a 6LoWPAN fragment is truncated to be a
multiple of eight bytes (since fragment offset can be only expressed
as multiples of eight). However this requirement does not apply to the
last fragment. This change helps avoid an unnecessary extra fragment
for messages of certain length.
2020-05-11 15:23:58 -07:00
Duda, Lukasz 2f683e6e76 [ip6] enhance handling of IPv6 fragmentation (#4940)
This commit introduces a few enhancements:

- In NCP architecture forward the IPv6 fragments instead of the full
  reassembled IPv6 packet (which in the default configuration can't be
  forwarder due to SPINEL limitations). Without this fix the
  fragmentation does not work if Thread device wants to send more than
  MTU data through the Border Router (to the IPv6 address of NCP).

- Use OPENTHREAD_CONFIG_IP6_MAX_ASSEMBLED_DATAGRAM only for the
  receiving path. For transmitting path, relay on the message buffers
  pool. This is especially important for some of the use-cases we
  have, and also reduce a need for regenerating OpenThread libraries.

- In case receiving IPv6 packet is bigger than supported
  OPENTHREAD_CONFIG_IP6_MAX_ASSEMBLED_DATAGRAM, exit before trying to
  allocate the next message buffer.
2020-05-11 15:22:18 -07:00
Duda, Lukasz 069afa5a17 [ip6] do not free the same message twice while handling IPv6 fragment (#4940)
This commit fixes the serious bug when IPv6 fragmentation is
enabled. It is possible that HandleDatagram which is called on
complete reassembly, returns the error (e.g. because ICMPv6 Echo
Response can't be generated due to lack of buffers). In such case both
HandleDatagram method and HandleFragment tries to free the same
message which finally ends up in a crash of the system.
2020-05-11 15:22:18 -07:00
Duda, Lukasz 9aa7340eb2 [ncp] ensure IPv6 packet length does not exceed maximum size of SPINEL command payload (#4940)
With the current code, it is possible that NCP tries to send IPv6
packet larger than the maximum size of SPINEL command payload.

This commit adds additional defines to spinel.h and proper checks in
NCP codebase.
2020-05-11 15:22:18 -07:00
Jonathan Hui c5b9c3efac [netif] change UnsubscribeAllRoutersMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui f97aacb501 [netif] change SubscribeAllRoutersMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 19ecc83acc [netif] change UnsubscribeAllNodesMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 8ff86bba70 [netif] change SubscribeAllNodesMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 6a3e04a48f [netif] change UnsubscribeMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui e8d6705fdd [netif] change SubscribeMulticast() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 3bc11b88bf [netif] change RemoveUnicastAddress() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 2607671f33 [netif] change AddUnicastAddress() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui cf57110c47 [message-queue] change Dequeue to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui 7540758076 [message-queue] change Enqueue() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui af207d18d7 [coap] change AddResource() to return void (#4942) 2020-05-11 14:07:25 -07:00
Jonathan Hui ccaefa3e39 [commissioner] change SendKeepAlive() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 988d39ba34 [joiner-router] change DelaySendingJoinerEntrust() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 97debabc03 [dhcp6-server] change AddPrefixAgent() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 0315ac0a0f [dhcp6-client] change Solicit() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui e79a7be773 [icmp] change SendIcmpError() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui d20a65b87c [meshcop] change "send" methods to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 4e9cefbb84 [energy-scan-server] change SendReport() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 5590771eb8 [coap] change SendCopy() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 5b8b36ab11 [sntp-client] change SendCopy() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 20ed51796d [dns-client] change SendCopy() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 71af8794bd [panid-query-server] change SendConflict() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 30bf77808e [network-data] change RegisterNetworkData() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 4f05c99e17 [network-data] change RemoveCommissioningData() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui e55906c5eb [mesh-forwarder] change GetForwardFramePriority() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 19ac977b08 [address-resolver] change SendAddressError() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 1e5d816838 [address-resolver] change AddSnoopedCacheEntry() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 29c2d11170 [mac] change RequestDirectFrameTransmission() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 1578346dce [indirect-sender] change AddMessageForSleepyChild() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 8172e31a47 [trickle-timer] change Start() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 8a27e6da83 [data-poll-sender] change StopFastPolls() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 11db44e36a [data-poll-sender] change StartPolling() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui eac2dd9d07 [data-poll-handler] change RequestIndirectFrameTransmission() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 7d8567d57b [announce-sender] change SendAnnounce() to return void (#4941)
- Move "start" log to common method.

- Use default param value instead of duplicate method.
2020-05-11 12:44:54 -07:00
Jonathan Hui 07120a8a54 [mle] change RefreshStoredChildren() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 3ce4159414 [mle] change SendAddressRelease() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui a173ed3838 [mle] change SendDataResponse() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 8ca96f0fd6 [mle] change SendAdvertisement() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 532a44b76d [mle] inline AddLeaderAloc() (#4941)
Also move Mle::AddLeaderAloc() to MleRouter::AddLeaderAloc().
2020-05-11 12:44:54 -07:00
Jonathan Hui 3f299d3701 [mle] change InformPreviousParent() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 40f4d20c9d [mle] change HandleChildStart() to return void (#4941) 2020-05-11 12:44:54 -07:00
Jonathan Hui 86be53e190 [mle] change message handlers to return void (#4941)
Returned errors were always being ignored.
2020-05-11 12:44:54 -07:00
Abtin Keshavarzian a1adaac91a [tasklet] change Post() to return void (#4939)
This commit changes the `Tasklet::Post()` method to return `void`
instead of `otError`. This helps simplify its use. The error indicated
whether the tasklet was already posted and was always ignored
(required `IgnoreError()` when posting tasklets). `IsPosted()` method
can be used to determine this when/if needed.
2020-05-11 10:24:58 -07:00
Yakun Xu 1dd0abc591 [style] fix unused variables in release build (#4938)
* change package check build Release
2020-05-09 17:15:21 -07:00
Moandor 92b290e018 [continuous-integration] avoid coverage data loss (#4937)
The code coverage data generated by ./script/test build expect will be
erased by VIRTUAL_TIME=0 NODE_MODE=rcp ./script/test clean build
expect's clean step, causing coverage less than actual value. This
adds an upload step after the first run to avoid the data loss.
2020-05-08 17:03:11 -07:00
Li Cao 417093e247 [tests] fix key_id_mode handling and add exception handle (#4927)
This commit fixes key_id_mode handling and added exception handling
when key_id_mode is 0.

According to IEEE Std 802.15.4-2015, when Key Id Mode is 0x00:

    Key is determined implicitly from the originator and recipient(s)
    of the frame, as indicated in the frame header.

Our test scripts cannot handle such packets. If we leave key_id_mode =
0 case unhandled, we would get some exceptions that may cause
developers to think that something is wrong. However dropping packets
in this case is a normal behavior.
2020-05-07 21:33:30 -07:00
Moandor 60aa241594 [error] disable error checking enforcement for old versions of clang (#4932)
With clang older than 3.9, the warn_unused_result feature works only
with functions and classes, not enums. This disables it if the clang
version is too old.
2020-05-07 10:36:06 -07:00
Abtin Keshavarzian f411a412be [toranj] update build script to treat "warning as error" under cmake (#4931) 2020-05-06 22:05:25 -07:00
Abtin Keshavarzian b07a33acec [continuous-integration] add macOS build config with clang compiler (#4931) 2020-05-06 22:05:25 -07:00
Abtin Keshavarzian 612e10e664 [error] add missing IgnoreError (#4931) 2020-05-06 22:05:25 -07:00
Moandor 64dfe6349c [posix] remove duplicate otExitCodeToString definition (#4928) 2020-05-06 18:45:03 -07:00
Yakun Xu f7a4d05219 [cmake] add project version (#4929)
* use an older version for better compatibility
* add version to project
* only use cpack when OpenThread is the top-level project
* exclude posix apps when BUILD_EXECUTABLES is OFF
* exclude all third_party
2020-05-06 17:46:13 -07:00
Diego Ismirlian eb4125c97d [build] add -Wcast-align to detect potential alignment issues when casting (#4923) 2020-05-06 17:42:48 -07:00
kangping 49f36f8c24 [error] force error checking (#4784) 2020-05-06 11:17:58 -07:00
Rongli Sun 6e8f2c9913 [dua] MTD prioritizes DUA in Address Registration TLV (#4862)
Thread 1.2 spec requires prioritizing DUA in Address Registration TLV
to ensure DUA could be stored in the limited addresses space for Child
on the parent.
2020-05-05 18:16:59 -07:00
doublemis1 2153f5a4f4 [harness-automation] add another PDU Controller for EATON by SNMP (#4688)
Another PDU Controller used to power cycle between tests. Based by
SNMP protocol. To use EATON_PDU_CONTROLLER is needed PySNMP module
(added to requirements.txt). Also extend settings_sample.py by
comments with needed parameters to create EATON_PDU_CONTROLLER.
2020-05-04 14:43:34 -07:00
kangping e08f5aebd9 [joiner] use random extended address for discovery request (#4920)
Thread specification requires the source address of Discovery Request
to be random value. While for subsequent messages, the joiner should
use hash of EUI-64 (joiner ID) value.
2020-05-04 11:04:05 -07:00
rob-the-dude 9faa71dc3e [logging] fix typo for otDumpNote definition (#4922) 2020-05-02 23:28:41 -07:00
rob-the-dude b378eb1aa8 [posix] fix two compile-time errors for macOS utun driver (#4921) 2020-05-02 23:27:22 -07:00
Yakun Xu 7b0cb98445 [posix] add argument to set max power table (#4878)
This commit adds a max power table for POSIX platform, which can
customize the max allowed transmit power of each channel with the
command line argument --max-power-table.
2020-04-30 14:23:16 -07:00
kangping c4b098f0d3 [instance] fix multiple instance compilation (#4915) 2020-04-30 12:27:42 -07:00
Yakun Xu 47ebcbd184 [cmake] add log output option (#4914)
This is required for running commissioning related tests for the
commissioning messages are retrieved from logs.
2020-04-30 10:45:14 -07:00
Moandor 8d6610f3d5 [continuous-integration] add POSIX SPI build (#4913)
This adds a CI build for POSIX platform with SPI enabled.

Also fixed a build error in `spi_interface.cpp`.
2020-04-30 10:42:44 -07:00
Abtin Keshavarzian 4cf2abc24e [toranj] fix typos (#4917) 2020-04-29 23:03:27 -07:00
Simon Lin 56cf651fb2 [test] fix script/test on macOS (#4916) 2020-04-29 23:02:58 -07:00
Rongli Sun 2e85801083 [dua] Domain Unicast Address generation (#4854)
This commit includes
[Y] add `OPENTHREAD_CONFIG_DUA_ENABLE` option for DUA feature
[Y] generate DUA via SLAAC
[Y] update test script to verify communication via DUA
2020-04-29 22:57:50 -07:00
Rongli Sun 904e12d047 [slaac] allow customized parameters when GenerateIid() (#4854) 2020-04-29 22:57:50 -07:00
Simon Lin bbcfc3ca1e [commissioner] remove duplicate MGMT_COMMISSISONER_SET.req (#4902)
- Remove the unnecessary MGMT_COMMISSISONER_SET.req sent by
  Commissioner to Leader when a Joiner is removed only to be added
  back.

- Use proper error codes for MleRouter::HandleDiscoveryRequest
2020-04-29 18:39:43 -07:00
Jing Ma 46d5343d95 [cmake] move cc1352 & cc2652 libs to third-party cmake file (#4875) 2020-04-29 15:48:55 -07:00
Yakun Xu 81fb1210c4 [continuous-integration] recover verbose check (#4911)
The error logs of `check` will only be printed when VERBOSE=1.
2020-04-29 11:03:21 -07:00
Abtin Keshavarzian 0ffe586ae8 [dataset-manager] adding DatasetTlv (a generic Dataset TLV to read from msg) (#4907) 2020-04-29 11:01:48 -07:00
Abtin Keshavarzian 0877efe2eb [mac] verify that Security Level is correct in rx frame (#4905)
This commit adds a check in `Mac::ProcessReceiveSecurity()` to verify
that the Security Level in the received frame is properly set to
`kSecEncMic32` before trying to decrypt and validate the frame. This
helps avoid performing AES-CCM when frame is invalid and also avoid
potentially reading beyond the frame length when checking MIC/footer.
2020-04-29 10:55:51 -07:00
Rafał Kuźnia 696d6389e6 [mac] disable SubMac on instance finalization (#4903)
When OT is initialized after boot, finalized, and initialized again
without reboot, assertion in SubMac::Enable is triggered. The reason
is that SubMac::Disable is never called during finalization and
platform radio is in unexpected state.
2020-04-29 10:54:46 -07:00
Simon Lin dd3b14dad0 [commissioner] fix duplicate commissioner start (#4899)
This commit fixes the bug that duplicate commissioner start will
incorrectly close CoapSecure.
2020-04-29 10:51:43 -07:00
Simon Lin e5069a41d5 [scripts] update cert tests to use thread_cert.TestCase (#4874)
- Update all test cases to inherit thread_cert.TestCase and update
  topologies accordingly. The topologies should all be correct because
  they are automatically generated, not hand written.

- Use default Thread version: 1.1

- Cleanup node tmp files in tmp directory according to the current
  PORT_OFFSET in setUp. This is required by
  test_reed_address_solicit_rejected.py and test_coap_observe.py since
  they define multiple test functions in one TestCase.

- Removed call to set_extaddr64 because it's not necessary and causing
  failures.
2020-04-29 10:41:04 -07:00
Jeff Bumgardner 90ecb574bb [docs] update Doxygen menu for OTNS and BBR (#4908) 2020-04-29 10:29:02 -07:00
Jonathan Hui ebb52da68e [continuous-integration] add macos posix build check (#4906) 2020-04-28 22:52:20 -07:00
rob-the-dude 1a43e27d47 [posix] refactoring of netif code, mostly to accommodate BSDs (#4664)
This code does the following:

- provides an implementation to manage networking notices from a PF_ROUTE socket,
	instead of (the Linux-specific) PF_NETLINK

- breaks out some of the platform-specific mechanisms for configuring a tunnel
	device (Linux, mac OS, and NetBSD are all different in some ways)

- provides handling of I/O to the tun drivers on BSDs (where there's a 4-byte
	header prepended to identify the IP version)

- adds some debugging info and more deliberate error handling (I suspect
	there are some more OpenThread-friendly ways to do some of the
	debugging, but I didn't try to figure them out)
2020-04-28 18:18:44 -07:00
Moandor-y c76d325b21 [continuous-integration] add clang 32 bit build (#4896) 2020-04-28 16:45:47 -07:00
Moandor-y 15a443dd0c [spinel] fix time narrowing conversion (#4896)
This makes narrowing conversions of time types explicit to fix build
errors.
2020-04-28 16:45:47 -07:00
Rongli Sun c8efee95f3 [nits] unify size_t type for local variable when OT_ARRAY_LENGTH is used (#4894) 2020-04-28 16:31:25 -07:00
Rongli Sun 79f1d4c5c8 [core] ApplyMeshLocalPrefix() to applicable ALOCs (#4894) 2020-04-28 16:31:25 -07:00
Seth Rickard 972acd734f [build] add unused code macros after asserts (#4885)
This change is to address some warninings present on the ti-cgt
toolchain. Code after a while(true) loop or an unconditional jump
results in a dead code warning.
2020-04-28 16:07:43 -07:00
kangping 80285206d2 [tests] add 5_7_01 network diagnostic test cases (#4663)
This commit adds Network Diagnostic TLV parsing and 5.7.01 test case.
2020-04-28 13:37:21 -07:00
Jonathan Hui 0778831ecd [toranj] update address cache table test (#4879)
Updated test-021-address-cache-table.py to reflect cache entry
invalidation when sending to a neighbor that does not have the
destination.
2020-04-28 11:30:13 -07:00
Jonathan Hui 3c09c378d4 [mesh-forwarder] ensure mesh dst checks for dst unreach (#4879)
An out-dated EID-to-RLOC map cache may lead a device to send an IPv6
datagram to a device that does not have the IPv6 Destination Address
assigned to its interface. However, the existing implementation would
not send back an ICMPv6 Destination Unreachable message necessary to
invalidate the originator's EID-to-RLOC cache entry.

This implementation adds reachability checks on the mesh destination
receive path to ensure that reachability checks are performed in the
above situation.
2020-04-28 11:30:13 -07:00
Jonathan Hui 2567aec36f [mesh-forwarder] send all message fragments to the same mesh dest (#4879)
All fragments for a given IPv6 datagram must be sent to the same
destination. Otherwise, there is not much point in transmitting the
messages.
2020-04-28 11:30:13 -07:00
kangping 509807e377 [cmake] enable user specified mbedtls target (#4812)
This commit allows users to specify the mbedtls target by a
OT_EXTERNAL_MBEDTLS option.

The native cmake build system of mbedtls is not so "modern" (for
backward compatibility, it maybe hard to change it soon) and
applications using mbedtls are likely to write wrapper cmake files and
targets by themselves.
2020-04-28 11:28:09 -07:00
Simon Lin c169c2c552 [tests] add Thread 1.2 all features build test (#4850) 2020-04-27 23:46:28 -07:00
Rongli Sun baa5fdfebe [bbr] move bbr relative addresses to BackboneRouter::Local (#4893) 2020-04-27 20:45:13 -07:00
Rongli Sun 5c7c147ff2 [address-resolver] fix ADDR_NTF.ans to use Child's Mesh Local IID (#4898) 2020-04-27 18:27:14 -07:00
Abtin Keshavarzian 83d73fc9f2 [mac-frame] helper methods to calculate size of headers/MIC (#4887)
This commit adds new helper methods in `Mac::Frame` to calculate the
size (number of bytes) of headers or security MIC. These are used by
different methods to simplify the code and avoid repeated patterns:
- `CalculateAddrFieldSize(aFcf)` to calculate the size of Address
  Fields given a Frame Control value.
- `CalculateSecurityHeaderSize(aSecurityControl)` to calculate size
  of Security Header given a Security Control value.
- `CalculateMicSize(aSecurityControl)` to get the size of MIC given
  a Security Control value.
2020-04-27 18:06:09 -07:00
Jonathan Hui c1f0856adb [style] remove const from uint16_t function/method params (#4901) 2020-04-27 12:59:24 -07:00
Yakun Xu 7c428118f0 [cmake] detect big endian (#4892) 2020-04-27 12:58:46 -07:00
Yakun Xu a58163c9a3 [test] allow extra options (#4891)
Example:

```bash
OT_OPTIONS="-DOT_FULL_LOGS=ON -DOT_LOG_LEVEL_DYNAMIC=OFF" ./script/test clean build
```
2020-04-27 09:37:29 -07:00
Yakun Xu 779da7c858 [diag] initialize tx power and channel on start (#4890) 2020-04-26 10:02:28 -07:00
Yakun Xu b19aafc76d [mac] fix warning in mac_types.hpp (#4889) 2020-04-26 10:01:55 -07:00
Abtin Keshavarzian 931cdedc84 [dataset] misc enhancements (#4888)
This commit contains a group of smaller enhancements/simplifications
in `Dataset` modules:
- Add helper `GetTlvsStart()` and `GetTlvsEnd()` to get start/end
  of Dataset TLVs sequence.
- Use `for` loop when iterating over TLVs.
- Simplify `RemoveTlv()` to get a pointer to TLV as input
- Remove single-use local TLV variables (in switch statements).
- Simplify `DatasetLocal::Compare()`.
2020-04-25 14:53:35 -07:00
Yakun Xu be48ea648c [thread-cert] use the same mesh local prefix as Thread harness (#4089) 2020-04-24 17:24:53 -07:00
Jonathan Hui 082f7e9fdc [docs] apply prettier changes (#4881) 2020-04-24 16:22:00 -07:00
Jonathan Hui c48f84d9ea [pretty] add markdown support (#4881) 2020-04-24 16:22:00 -07:00
Yakun Xu 32f8274395 [cmake] enhancements for supporting cmake in ot-br-posix (#4876) 2020-04-24 16:21:06 -07:00
Abtin Keshavarzian 7e5dce0542 [tests] update Mac::Frame unit test to check footer and frame length (#4883) 2020-04-24 16:15:02 -07:00
Abtin Keshavarzian 3921409859 [mac-frame] ensure frame length is correctly updated from InitMacHeader() (#4883)
This commit directly updates the `mLength` from `InitMacHeader()` as
it prepares the frame header (instead of setting it at the end).

This ensures that `InitMacHeader()` can safely call other `Frame`
helper methods (e.g. `GetFooterLength()` which itself does check
the frame length).
2020-04-24 16:15:02 -07:00
Rongli Sun 60be2be68a [mle] 1.2 MED registers MA (scope > 3) to its parent via AR TLV (#4837) 2020-04-24 10:17:55 -07:00
Yakun Xu a13d8b958f [cli] fix infinite loop on networkdiagnostic (#4882)
Reproduce by issuing networkdiagnostic get ff03::1 0 1 on one router.
2020-04-24 08:49:21 -07:00
Jonathan Hui c0075d42c3 [pretty] fix yapf version to 0.29.0 (#4880)
v0.30.0 (released on 2020-04-23) introduces formatting changes that
are not compatible with v0.29.0.
2020-04-23 17:14:58 -07:00
Sagar Chinchani 4f3b66bf7e [efr32] update NVM3 to use default instance (#4849)
This commit updates the nvm3 support implementation to use the nvm3
default instance instead of creating a separate nvm3 instance. This
approach enables us to share the nvm3 system using a single default
instance between OpenThread and any other stack or application used
along with OpenThread.

This commit also adds the otPlatFlash* APIs back in flash.c that were
incorrectly removed in a prior commit. These APIs are required when
using the default NV system.
2020-04-23 09:15:45 -07:00
Jing Ma 8822fcd590 [cmake] add support for cc2650, qpg6095, samr21 (#4729) 2020-04-22 18:43:44 -07:00
Jonathan Hui 577cccfeff [cli] add factoryreset for Joiner in README_COMMISSIONING.md (#4868) 2020-04-22 13:47:38 -07:00
richarddonkin c2f316fead [cc1352,cc26xx] fix unaligned access of ext address in radio.c (#4617)
This avoids misaligned  memory access that was caused by the
byte-aligned pointer being dereferenced as a uint64_t pointer.
2020-04-22 13:46:37 -07:00
Yakun Xu 5632c271b8 [posix] use enumerations for RCP bus (#4871)
This commit changes the way to define RCP bus type. It now defines two
enumerations for UART and SPI. This ensures only a single bus type is
enabled, and helps keep compatible with projects using UART bus.
2020-04-21 23:23:12 -07:00
Jiacheng Guo 25b29a1ade [platform] fix errno undefined on some libc (#4865) 2020-04-21 23:20:33 -07:00
Yakun Xu c034fd0c0c [size-report] support local check (#4866) 2020-04-21 15:37:46 -07:00
Bob MacDonald 85f40acbe4 [joiner] fix code coverage typo (#4867) 2020-04-21 15:05:30 -07:00
Abtin Keshavarzian 29d7e69f23 [dataset] add GetTlv<Type>(), and SetTlv() for simple TLVs (#4856)
This commit adds helper method `MeshCoP::Tlv::FindTlv()` to search
within a given sequence of TLVs for a specific TLV type. This is used
to simplify `Dataset::GetTlv()` and provide a template version
`GetTlv<TlvType>()`. This commit also adds new flavors of `SetTlv()`
for simple TLVs, i.e, TLVs with a single value which is either an
`uint16_t` or `uint32_t` value or can be treated a data blob.
2020-04-21 10:42:33 -07:00
Zhanglong Xia 7fd9715d71 [nrf52811] use the default heap size to save RAM (#4864)
The nRF52811 is designed to work in RCP architecture where DTLS is
established on the host level. The nRF52811 doesn't support Joiner or
Border Agent roles. This commit enables nRF52811 to use default heap
size to save RAM.
2020-04-21 09:26:17 -07:00
Li Cao e839100be1 [cmake] enable running simulation unit tests using cmake (#4842)
In this commit, we would be able to run all the simulation unit tests
easier with cmake:

./script/test clean build unit_tests
2020-04-20 20:52:38 -07:00
Jiacheng Guo 8de4ab4740 [spinel] platform independent spinel radio (#4705)
This change refactors radio-spinel into a platform independent
header-only library so that other platforms (baremetal/RTOS) can
enable Thread with RCP mode as well.
2020-04-20 20:50:58 -07:00
Jiacheng Guo f37d72e5ca [posix] open netif fds with O_NONBLOCK in a compatible way (#4804) 2020-04-20 19:06:07 -07:00
Jonathan Hui af4837d122 [network-data] fix length overflow in ServiceTlv::IsValid() (#4855) 2020-04-17 21:19:22 -07:00
Yakun Xu 68fc38865a [docker] add docker file for android check (#4852) 2020-04-17 18:43:02 -07:00
Jonathan Hui 5b44a7d595 [docs] update CONTRIBUTING.md (#4857) 2020-04-17 18:39:13 -07:00
Simon Lin 8efa1ee4c6 [mle] REED to handle rejected ADDR_SOL.rsp (#4834)
Currently, a REED which expects to become Router soon does not send
any SVR_DATA.ntf.  This commit handles rejecting ADDR_SOL.rsp to allow
REED to send SVR_DATA.ntf after it is rejected.
2020-04-17 17:03:45 -07:00
Yakun Xu 1089aa9ff4 [continuous-integration] move android check to GitHub Actions (#4829) 2020-04-17 16:46:44 -07:00
Yakun Xu 4b55284bd2 [tests] add cli pskc command test (#4853) 2020-04-17 08:29:07 -07:00
Simon Lin 39de36a9c9 [github-actions] use matrix for gcc builds (#4851) 2020-04-17 08:27:36 -07:00
Simon Lin f797a42069 [logging] fix compile error for BBR region (#4848) 2020-04-17 08:22:36 -07:00
Abtin Keshavarzian 4b47deee5a [dataset] multiple enhancements (add Type, rename to GetTlv/SetTlv, etc.) (#4844)
This commit contains multiple enhancements in `Dataset` modules. It
adds a new enumeration `Type` to specify the type of a Dataset
(active or pending). It also renames the methods that get or a set a
TLV within the dataset to `GetTlv()` and `SetTlv()`. It also renames
methods converting the TLV format to/from an `otOperationalDataset`
structure. With the renames, we can remove the re-definition of
`Get<Type>()` method (since no longer being shadowed by other
definitions). Finally this commit updates some of the method
documentation.
2020-04-17 08:21:43 -07:00
Jonathan Hui 542eff9ba4 [network-data] validate Prefix and Service TLVs have sub-TLVs (#4843) 2020-04-17 08:20:42 -07:00
Yakun Xu fd6cde5981 [size-report] support github actions (#4825) 2020-04-16 23:22:01 -07:00
Li Cao ab029ec0ac [mac-frame] enhance utility functions (#4826)
This commit enhances some utility functions in mac frame for frame
parsing and adds some basic testing.

- Currently the mac frame parsing only doesn't include the rule for
  version 2015. This commit adds the parsing of dstPanId for 2015
  frames.

- This commit adds some helper function dealing with Security Header
  so that later commit of CSL and setting security header in enhanced
  ACK would be easier.
2020-04-16 23:11:45 -07:00
Jonathan Hui c34f3ef817 [samr21] fix build when logging is enabled (#4846)
- include "board.h" before its defines are used
2020-04-16 18:40:46 -07:00
Jonathan Hui 32e308833c [random] use crypto RNG in places were non-trival random is required (#4840) 2020-04-16 13:50:38 -07:00
Abtin Keshavarzian 69c3e2eed6 [ip6-address] helper methods to set Link-Local and RLOC/ALOC addresses (#4841)
This commit adds and uses a new method `SetToLinkLocalAddress()` in
`Ip6::Address` class which sets the address to a Link-Local IPv6
address with a given Interface Identifier (either given directly or
generated from a MAC Extended Address).

It also adds methods to set the address to a Routing/Anycast Locator
and updates methods checking RLOC/ALOC addresses. It adds a common
`IsIidLocator()` to check if the IID matches the `0000:00ff:fe00:xxxx`
pattern. More specific checks for RLOC or ALOC can be done by
`IsIidRoutingLocator()` or `IsIidAnycastLocator()`. The `Mle` and
other modules are updated to use the new/updated methods.
2020-04-16 10:39:35 -07:00
Rongli Sun b1ec563a81 [key-manager] add helper method (#4838) 2020-04-15 20:34:56 -07:00
Rongli Sun ec61d7e6fc [ip6] add check before adding or removing the unsecure port (#4839) 2020-04-15 19:59:48 -07:00
Markus Becker 8e932e8c77 [cmake] disable -pedantic-errors together with -Werror (#4775)
This allows to work-around a compile error that is happening in Zephyr
<https://github.com/zephyrproject-rtos/openthread/pull/9>.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-04-15 17:41:22 -07:00
Jonathan Hui 9e3e8e0980 [cmake] add pedantic-errors flag (#4808) 2020-04-15 15:32:26 -07:00
Jonathan Hui f9470ed187 [posix] avoid use of flexible array members in netif.cpp (#4808) 2020-04-15 15:32:26 -07:00
Jonathan Hui a4592234f8 [code-utils] avoid use of zero variadic macro arguments (#4808) 2020-04-15 15:32:26 -07:00
Jonathan Hui b669914963 [logging] avoid use of GNU extension ##__VA_ARGS__ (#4808) 2020-04-15 15:32:26 -07:00
Abtin Keshavarzian 14991d96d0 [ip6-address] methods to set address to common multicast addresses (#4832)
This commit adds methods to set an `Ip6::Address` to common multicast
addresses, link-local all-nodes/all-routers, realm-local all-nodes/
all-routers, or realm-local all MPL forwarders. The implementation
uses the constant addresses defined in `Netif` class.
2020-04-15 10:24:34 -07:00
Abtin Keshavarzian 7baefe62ed [network-data] define and use a common Iterate method for all entry types (#4830)
This commit adds a common private `Iterate()` method which is used by
other methods iterating over different types of entries:
`GetNextOnMeshPrefix()`, `GetNextExternalRoute()`, `GetNextService()`,
and `GetNextServer()`. It also adds methods to help advancing the
iterator to next TLV or sub-TLV or entry index.
2020-04-15 10:22:10 -07:00
Abtin Keshavarzian fc848485e0 [toranj] add test-case verifying Network Data update (#4817)
This commit adds a new test-case to `toranj` which verifies Network
Data update and version changes (stable only vs. full version).

The test creates a simple network of a leader with 3 children where
one of the children is SED and is configured to request only stable
Network Data. The test covers the following:
- Adding/removing prefixes (stable or temporary) on the first child.
- Verifying that Network Data is updated on all nodes accordingly.
- Ensuring correct update to Network Data version and stable version.

The above steps are then repeated over many different situations:
- Where the same prefixes are also added by other nodes.
- Or the same prefixes are added as off-mesh routes by other nodes.
2020-04-15 10:19:42 -07:00
Abtin Keshavarzian 4c7ec29e6d [network-data] enhance/simplify updating of network data on leader (#4817)
This commit changes the model for updating Network Data on a leader.

It adds `ChangedFlags` type which is used to track whether full or
stable version of Network Data gets changed as TLVs/sub-TLVs are being
added or removed. This is then used to update version and stable
version accordingly.

When registering new received Network Data on the leader, the new
model updates the Network Data in place. First, newly added
`Validate()` method is called to verify that the received Network Data
contains well-formed TLVs and sub-TLVs (e.g., no duplicate
Prefix/Service TLVs) and all sub-TLVs/entries match the sender's
RLOC16. Then, all entries in the current Network Data associated with
the sender's RLOC16 which are not present in the newly received data
are removed. Afterwards, any new entry in the received Network Data is
added. This approach helps simplify the code and ensures existing
TLVs/sub-TLVs remain as before (e.g., no need to keep a copy of
previous data to ensure same Service IDs are used when adding/removing
Service TLVs).

This commit also adds `UpdatePrefix()` and `UpdateService()` methods
which ensure a Prefix or Service TLV is marked correctly as stable or
not depending on its sub-TLVs (e.g., if all stable sub-TLVs are
removed the enclosing TLV is marked as not stable).
2020-04-15 10:19:42 -07:00
Rongli Sun bfef9c6a03 [logging] add bbr region (#4819) 2020-04-14 23:54:57 -07:00
Rongli Sun b37528645a [bbr] (Un)Subscribe AllDomainBBRs multicast address (#4795)
This commit includes:
- cache domain prefix in the Thread Network
- subscribe/unsubscribe AllDomainBBRs Multicast address
- update test to cover AllNetworkBBRs and AllDomainBBRs subscription
2020-04-14 19:36:14 -07:00
Jing Ma 911010a9bf [cmake] add support for kw41z (#4692) 2020-04-14 18:14:36 -07:00
Rongli Sun c2930f841f [meshcop] avoid unnecessary RemoveUnsecurePort (#4821) 2020-04-14 16:56:54 -07:00
Abtin Keshavarzian 9c45b68759 [qpg6095] fix license header typo in settings.cpp (#4831) 2020-04-14 13:16:16 -07:00
Rongli Sun 854a2309bd [domain] add domain name (#4815) 2020-04-14 09:08:42 -07:00
Jiacheng Guo c024fac54c [ip6] fix remove unsecure port behavior (#4822)
When removing unsecure port, we should not add aFromNcpHost filter since
the packet comes from the child.
2020-04-14 08:58:15 -07:00
Rongli Sun 06cc9bce51 [notifier] add string for flags newly introduced (#4820)
- OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE
- OT_CHANGED_THREAD_BACKBONE_ROUTER_LOCAL
- OT_CHANGED_JOINER_STATE
2020-04-13 22:19:00 -07:00
Simon Lin 0aa880e73c [address-resolver] use RLOC dest when send a/ae to child (#4811) 2020-04-12 23:01:21 -07:00
Yakun Xu 0cd682f048 [logging] dynamic level enhancements (#4809)
* Add cli command to get/set log level
* Add cmake option to enable dynamic log level
* Aggregate logfilename as sub-command of `log` command
* Add log level test
* Update readme
2020-04-11 22:11:38 -07:00
Rongli Sun 52777fb459 [bbr] support domain prefix addition and removal (#4793) 2020-04-11 22:05:04 -07:00
Jiacheng Guo a47ea011b1 [ip6] disable security for link-local packets from unsecure ports (#4782)
If this feature is enabled, OpenThread will automatically disable
link-level security for packets sent with unsecure source ports. Once
a secure packet is received on the unsecure port, this port will be
removed from the unsecure port list.
2020-04-10 12:26:53 -07:00
Abtin Keshavarzian 03f4a4317e [network-data] simplify ServiceTlv (#4806)
This commit updates the `ServiceTlv` implementation and its use.

- Set the `ServiceTlv` fields through a new `Init()`
- Use union for managing presence of Enterprise Number fields
- Add static helper `GetSize()` to get the size of a Service TLV
  with a given Enterprise number and Service Data length.
- Add `ServiceTlv::kThreadEnterpriseNumber` constant replacing the
  `THREAD_ENTERPRISE_NUMBER` definition.
2020-04-10 12:23:38 -07:00
Duda, Lukasz 2f618bd4a7 [joiner] align error logs with other modules (#4788) 2020-04-09 15:01:58 -07:00
Duda, Lukasz 881c7eb784 [border-agent] remove the OT_CHANGED_BORDER_AGENT_STATE enumeration (#4788) 2020-04-09 15:01:58 -07:00
Duda, Lukasz 58e771cbad [commissioner] ensure synchronization with Border Agent (#4788)
This commit fixes situation when Commissioner can't be turned on or off,
due to incorrect state of the Border Agent.

In order to fix it:
 - a new COMMISSIONER state in the notifier module has been introduced
 - Border Agent API is not colled from the commissioner_api.cpp file
2020-04-09 15:01:58 -07:00
Duda, Lukasz 92796224b8 [border-agent] use Notifier to update the state (#4788) 2020-04-09 15:01:58 -07:00
Jing Ma a6adf0322a [cmake] add support for cc2652 (#4691) 2020-04-09 13:11:13 -07:00
Jonathan Hui fe736641b2 [icmp] do not generate errors in response to errors (#4800) 2020-04-09 09:52:47 -07:00
Jonathan Hui adc62ecfe5 [icmp] pass full error-causing message when sending error (#4800) 2020-04-09 09:52:47 -07:00
Jonathan Hui 1f3e4552d6 [mesh-forwarder] move frame-to-message conversion to separate method (#4800) 2020-04-09 09:52:47 -07:00
Jonathan Hui 130e5b6a88 [mesh-forwarder] move ICMPv6 Dst Unreach call to mesh-forwarder (#4800) 2020-04-09 09:52:47 -07:00
Abtin Keshavarzian 737f7e349d [network-data] adopt const for methods, parameters, and local vars (#4802)
This commit declares methods, input parameters, and local variables as
`const` whenever possible in `NetworkData` modules. `const` versions
of methods (returning `const` pointer) are also added, e.g.,
`NetworkDataTlv::GetNext()`, `HasRouteTlv::GetFirstEntry()`,
`NetworkData::FindTlv()`, etc. For simpler (inline) methods, the
`const` version is directly implemented but for more complex methods,
the const version is the main implementation (defined in `cpp` file)
and non-`const` version is implemented using `const_cast` conversions
from the `const` method.

This commit also declares methods not using any member variable/info
as 'static' (e.g. `FindHasRoute()` or `FindContext()`). It also
declares `RemoveTemporaryData()` flavors removing internal sub-TLVs as
`private` (instead of `protected`) and fixes the logging in
`RemoveTemporaryData()` using input `aTlvs` now instead of `mTlvs`.
2020-04-09 08:26:04 -07:00
Jonathan Hui e16fca40c9 [mbedtls] leverage cmake provided by mbedtls (#4803) 2020-04-09 08:21:31 -07:00
Piotr Koziar dc21576f58 [network-data-notifier] fix flag for child removed notification (#4805) 2020-04-09 08:21:05 -07:00
Jing Ma 8d5fc20eda [harness-automation] fix case selection issue when using Chrome 80 (#4648)
elem.txt might be null when the required reference devices could not
be met (either due to the quantity or the type) for specific test.
perform() will throw exceptions if elem.text is null since Chrome and
chromedriver 80. If elem is not shown in current case list window,
move_to_element() will not work either.
2020-04-08 11:34:41 -07:00
Abtin Keshavarzian 91111c6237 [mle] add DeviceRole type, and IsChild, IsRouter, etc method (#4794)
This commit defines a new enum type `Mle::DeviceRole` mirroring the
public `otDeviceRole` enumeration. The enumerator in the new type
follow `kRole{Value}` style and intended for use in the core modules.
It also adds helper method in `Mle`, `IsChild()`, `IsRouter()`,
`IsLeader()`, etc to check the current device role.
2020-04-06 23:56:31 -07:00
Jiacheng Guo c265aebe9e [android] export CFLAGS and include directories (#4797)
This allows libraries depending on ot-core not to specify OpenThread
path and share the OpenThread configs.
2020-04-06 22:58:04 -07:00
Abtin Keshavarzian 79831b1443 [network-data] use GetLocator() when registering network data (#4798) 2020-04-06 21:28:33 -07:00
Jonathan Hui c64d296c94 [network-data] implement network data notifier (#4783)
This commit centralizes the timing logic for transmitting SVR_DATA.ntf
messages that are used to update network data at the leader.

This component helps ensure the following:

- At most one SVR_DATA.ntf message is outstanding at any given time.

- A timer to rety sending SVR_DATA.ntf messages if sending fails due
  to lack of memory buffers.

- A timer to rate limit SVR_DATA.ntf messages that are acknowledged
  but no corresponding change in the Thread Network Data was observed.

- Utilizes ot::Notifier to trigger logic on role, child state, and
  network data changes.
2020-04-06 21:27:51 -07:00
Jonathan Hui c6a258e3a5 [github-actions] include fuzz checks (#4792) 2020-04-04 14:39:59 -07:00
Abtin Keshavarzian 1e4f641115 [toranj] update test-039 to stagger initial address queries (#4791)
This commit changes the `test-039` to add delay between the initial
message tx to stagger the address query send times. This helps verify
the query timeout behavior.
2020-04-04 14:39:37 -07:00
Jonathan Hui 335305101f [coap] avoid div-by-0 error invalidating coap params (#4787) 2020-04-04 13:22:55 -07:00
Piotr Koziar d62e550ffa [nrf528xx] add defines needed for compilation with IAR in nrf_security (#4790) 2020-04-04 13:22:32 -07:00
Abtin Keshavarzian f9ce416f62 [address-resolver] ensure prev pointer stays valid on entry removal (#4789)
This commit simplifies the model for iterating through a linked
list by using a `prev` pointer as the iterator variable. This helps
fix an issue with the `prev` pointer not staying  valid when entry
is removed from the list during iteration.
2020-04-04 13:15:24 -07:00
Abtin Keshavarzian 6f95f43b6f [network-data] simplify code, user helper methods (#4780)
This commit contains the following changes in `NetworkData::Leader`:

- Simplify methods (`RemoveContext()`, `UpdateContextsAfterReset(),
 `FindServiceById()`, `RemoveRloc()`, etc) to use `FindTlv` when
  searching for TLVs of a given type.
- Removes redundant checks in `RlocLookup()`.
- Uses pointer to iterate through `BoderRouterTlv` or `HasRouteTlv`
  entries.
- Move simple getter/setter methods to header file (to be inline).
- Move variable decelerations into inner scopes when possible.
2020-04-03 23:15:58 -07:00
Jonathan Hui 159dc8877c [mesh-forwarder] fix bug in evicting from address resolver queue (#4786)
The existing MeshForwarder::RemoveMessage() implementation is specific
to evicting messages from mSendQueue. This commit generalizes the
method by retrieving the queue from the message itself.
2020-04-03 13:35:48 -07:00
Jonathan Hui f59641e484 [jn5189] remove unused files 2020-04-03 08:20:37 -07:00
Piotr Koziar dd02c9faa4 [nrf528xx] update nrf security (#4773)
- enabled new functionalities in nrf_security module
- updated mbedtls config file for nrf52833 and nrf52840
2020-04-03 07:59:58 -07:00
Abtin Keshavarzian 74ff650cf1 [network-data] add IncrementVersionAndStableVersion() (#4781)
This commit replaces `IncrementStableVersion()` with a new method
`IncrementVersionAndStableVersion()` which increments both version and
stable version. It helps simplify its use by other modules and also
ensures stable version is not updated without version. This commit
also adds a common private `IncrementVersions()` used by other methods
in `NetworkData::Leader`.
2020-04-03 07:32:25 -07:00
Yakun Xu 03aba30cd5 [meshcop] generate PSKc from passphrase (#4766) 2020-04-03 07:17:02 -07:00
Rongli Sun 787d6d3763 [core] use the common RouterIdSet class (#4756)
Currently there are four similar copies regarding Router Id set
separately in 1) RouteTlv in mle_tlvs.hpp; 2) ThreadRouterMaskTlv in
thread_tlvs.hpp; 3) RouterIdSet in router_table.hpp; 4) RouteTlv in
network_diagnostic_tlvs.hpp.

This commit extracts the common RouterIdSet class and apply it in the
four components, meanwhile keep one copy for RouteTlv and
ThreadRouterMaskTlv process in route_table.
2020-04-02 17:16:54 -07:00
Jonathan Hui 5902ce9222 [network-data] periodically check for stale child ids (#4779)
A parent is responsible for removing stale child entries from the
network data. The existing implementation only triggered a
SVR_DATA.ntf message when new network data is received. In some cases,
the SVR_DATA.ntf message may not be sent due to rate limiting or lack
of message buffers.

This commit turns this process into a periodic check to ensure that
stale child entires are removed even if a failure in sending the
SVR_DATA.ntf occurs.
2020-04-02 09:41:16 -07:00
Jonathan Hui 00f8567e88 [mesh-forwarder] include address resolving queue in message eviction (#4776)
The existing implementation only considered the forwarding queue when
looking for a message to evict. This ignores message buffers that may
be buffered in other message queues.

This commit adds the ability to evict messages in the address resolver
queue. The lowest priority message from either the forwarding or
address resolver queue is selected for eviction.
2020-04-02 08:35:16 -07:00
garyButt 5ef14ccc9c [efr32] add nvm3 support (#4521)
silabs nvm3 support is selected by setting following macro in
    openthread-core-efr32-config.h :-
    #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
2020-04-02 08:33:33 -07:00
Jing Ma 64e03b8347 [cmake] add support for cc1352 (#4690) 2020-04-01 23:53:34 -07:00
Abtin Keshavarzian 602d975596 [toranj] add new test-case for cache table snoop (#4600) 2020-04-01 18:15:29 -07:00
Yakun Xu bac6d8c85d [mac] remove disable CSMA-CA on the last transmit (#4765) 2020-04-01 18:09:22 -07:00
Abtin Keshavarzian ff5a3e0737 [toranj] update test-602-channel-select to add extra wait (#4777)
This commit changes the `test-602-channel-manager-channel-select` to
wait for sample count to reach a limit (within a wait interval). This
should help make the test more robust (e.g., in RCP/POSIX mode) when
the simulation processing time may require more time (note that this
test is run with very high speed-up).
2020-04-01 12:19:41 -07:00
Thomas 7fd9902c38 [gp712] align with the new otPlatFlash API (#4774) 2020-04-01 10:24:24 -07:00
Abtin Keshavarzian 3579a68b93 [network-data] fix FindTlv() to return NULL when TLV sequence is malformed (#4771) 2020-04-01 10:23:11 -07:00
Simon Lin 8423ed3042 [simulation] enhance simulation for OTNS (#4268)
This commit is to support OTNS by:
- raising the max number of simulating nodes to 999 if OTNS=1
- implementing the status-push mechanism

To build:

$ make -f examples/Makefile-simulation OTNS=1

This commit should have no change of OpenThread behaviors on platforms
except simulation.
2020-04-01 10:19:36 -07:00
Jonathan Hui daa626b504 [github-actions] add apt update to each build (#4772) 2020-03-31 23:09:08 -07:00
Abtin Keshavarzian bb86ae4c76 [toranj] remove unused age property when parsing cache table (#4599) 2020-03-31 12:11:24 -07:00
Abtin Keshavarzian ee0dc4f9bb [spinel/ncp] update address cache table property to include additional info (#4599)
This commit expands the `SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE`
property format to include more info about address cache table. This
change keeps the definition backward compatible by not changing
existing format and only adding new (optional) fields.
2020-03-31 12:11:24 -07:00
Abtin Keshavarzian 451a72f750 [address-resolver] update public OT API for getting cache table (#4599)
This commit updates the public OpenThread APIs to get the address
cache table. The new APIs allows to iterate through all entries
(including in query or retry mode) and provides more info about the
entries, e.g., current timeout, retry delay (if entry is in
query/retry state), or the mesh-local EID, last transaction time (if
entry is in cached state).
2020-03-31 12:11:24 -07:00
Abtin Keshavarzian ee4bc9cb12 [address-resolver] update how the cache table changes are logged (#4599)
This commit adds a new helper method `LogCacheEntryChange()` which
logs any change (entry added/removed/updated) and its reason in
address cache table.
2020-03-31 12:11:24 -07:00
Abtin Keshavarzian 17617a2ee4 [address-resolver] use linked-list and enable snooped entry timeout (#4599)
This commit contains multiple enhancements in `AddressResolver`:

Cache entries are stored in different lists: Cached list (entries in
use), query list (entries actively querying and waiting for address
notification response), query-retry list (entries in delay wait mode
due to prior query failing to get a response), and snooped list
(entries discovered through received message inspection aka snoop
optimization). Singly linked list is used which helps keep the entries
sorted based on the order of use (whenever a cache entry is used to
resolve an address, it is moved to the head of the list). This
replaces and simplifies the aging model.

This commit updates the cache entry class definition to use `union`
for member variables (like timeout or transaction time) that are tied
to entry being in different lists. This help reduce the memory
requirement for cache table.

This commit also adds a new mechanism to manage snooped entries. When
a new snooped entry is added, we do not allow it to be evicted for a
short timeout. This allows some delay for a response message to use
the entry (if entry is used it will be moved to the cached list). If a
snooped entry is not used after the timeout, we allow it to be
evicted. To ensure snooped entries do not overwrite other cached
entries, we limit the number of snooped entries that are in timeout
mode and cannot be evicted by a (build-time configurable) threshold.
2020-03-31 12:11:24 -07:00
Abtin Keshavarzian 8a5f538e6f [linked-list] change PopAfter() parameter to be a pointer (#4599)
This commit changes `LinkedList::PopAfter()` method to accept a
pointer to a previous entry as a parameter. If the previous entry
pointer is NULL the entry at the head of the list is popped.
2020-03-31 12:11:24 -07:00
Jonathan Hui 3560ed06f7 [docs] add lgtm.com status badge (#4762) 2020-03-31 08:01:32 -07:00
Rongli Sun 999b29dcc2 [ip6-address] add SetMulticastNetworkPrefix() for Prefix-Based Multicast Address (#4757)
This commit also replaces the relevant magic numbers with the
constants `MeshLocalPrefix::kLength` and `MeshLocalPrefix::kSize`
2020-03-31 08:01:17 -07:00
Jiacheng Guo 4597d5e03f [posix] fix mld process invalid arguments (#4764) 2020-03-31 07:59:54 -07:00
Rongli Sun 77ea86302e [cli] add childip max command (#4759)
Thread 1.2 test harness requires the ability to set the number of IP
address the parent could store per child to test the reaction of the
Child DUT. The value intentionally may not conform to the Conformance
Specification. Since it is only used for reference device, this commit
wraps relevant APIs in the OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
macro.
2020-03-31 07:58:51 -07:00
Piotr Koziar d85c0007a1 [network-diagnostic] replace anonymous structs in netdiag.h (#4760) 2020-03-30 19:01:59 -07:00
Jiacheng Guo e2be5c475c [posix] add support for multicast group join (#4687)
Listen for mld reports sent by kernel to capture user multicast group
join and forward the addresses to OpenThread interface.

See openthread/wpantund#444 for more background.
2020-03-30 14:14:55 -07:00
Abtin Keshavarzian 8328aff1d9 [toranj] change start.sh to remove variable check to retry failed test (#4761)
This commit changes the `start.sh` script to remove the check for the
environment variable (which is specific to travis) before allowing
retry of failed tests. This should help with robustness of the tests
on GitHub Actions.
2020-03-30 13:32:39 -07:00
Abtin Keshavarzian eb5b3a41a9 [network-data] adding helper methods, simplify code (#4743)
This commit contains the following changes in `NetworkData` modules:

- Add helper `FindTlv()` and template version `FindTlv<TlvType>()` 
  methods to search within a sequence of TLVs to find a TLV with a 
  given type (and/or stable  status).
- Add methods to help with iterating over Network Data content 
  (`FindTlv`, `IterateToNextTlv()`, etc).
- Add `AppendTlv()` and `RemoveTlv()` helper methods to simplify 
  adding and removing of entire TLV from Network Data.
- Change `PrefixMatch()` to use `Ip6::Address` method.
- Simplify and fix `RemoveTemporaryData()` (use cast to get the 
  sub-TLV during iteration).
- Simplify `GetNextServer()` implementation to use other methods to 
  iterate over all on-mesh prefix, external route, and service 
  entries in Network Data. 
- Simplify the `Local::UpdateRloc()` implementation.  
- Add `Local::AddPrefix()` and `Local::RemovePrefix()` methods to 
  share common code for adding on-mesh or external route entries.
- Add helper `GetTlvsStart()`/`GetTlvsEnd()` to get the start/end 
  of Network Data TLV sequence.
2020-03-30 12:21:20 -07:00
Jonathan Hui f8de062657 [mesh-forwarder] do not remove router on link failures (#4753)
A router coming out of reset sends a Link Request to re-establish its
router role and links to neighboring routers. The existing
implementation only responds to such Link Requests when a valid
neighbor entry is found. This check is too strict and can cause
partitions to remain for a couple minutes. The Thread Specification
only requires a router to check that the Router ID is currently
allocated.

This commit updates the implementation to be conformant with the
Thread Specification and allows routers coming out of reset to
resynchronize even when a neighboring router has detect a link
failure.
2020-03-30 11:47:37 -07:00
Piotr Koziar ec9968e1d1 [meshcop] rename leader.cpp to meshcop_leader.cpp (#4754) 2020-03-30 09:14:16 -07:00
Rongli Sun 132df25505 [bbr] (Un)Subscribe AllNetworkBBRs Multicast address (#4755) 2020-03-29 23:13:43 -07:00
Rongli Sun 3535176535 [core] remove useless code for the old mLinkLocal16 (removed in #913) (#4750) 2020-03-28 09:07:19 -07:00
Jonathan Hui ba19a298a1 [script] add build option to check-posix-pty (#4748) 2020-03-27 23:16:51 -07:00
Jonathan Hui 5790e31ea4 [docs] add GitHub Action status badges (#4747) 2020-03-27 16:21:34 -07:00
Jonathan Hui dc0ae98927 [github-actions] migrate more checks from Travis (#4746)
- gn-build
- distcheck
- posix-spi
- posix-ncp-rcp migrate
- time sync
2020-03-27 14:32:59 -07:00
Piotr Koziar e4dd1da67d [nrf528xx] fix Keil compilation error in nrf_ficr.h (#4744) 2020-03-27 08:57:03 -07:00
Jonathan Hui d7fcb38386 [travis] disable simulation checks that exist in GitHub actions (#4737) 2020-03-26 21:32:26 -07:00
Jonathan Hui 275c38a5d2 [meshcop] reduce maximum number types in MGMT_GET.req (#4740) 2020-03-26 21:32:16 -07:00
Jonathan Hui bd5549b1bb [lowpan] avoid comparison of narrow type with wide type in loop (#4739) 2020-03-26 21:32:06 -07:00
Łukasz Duda f58319f82a [nrf528xx] align flash driver to the new otPlatFlash* API (#4742) 2020-03-26 15:29:22 -07:00
kangping e28608cd0b [network-diagnostic] improve usability of Network Diagnostic API (#4619)
This commit improves usability of Network Diagnostic API by:

- Define native structures to represent various Network Diagnostic TLV
  values.

- Add facility function otThreadGetNextDiagnosticTlv to parse plain
  otMessage into structured data.

- Dump parsed DIAG_GET.ans/.rsp message in readable format for
  networkdiagnostic CLI command.
2020-03-26 13:43:40 -07:00
Rongli Sun 315a27bf08 [bbr] add backbone router service (#4430)
- Introduce BACKBONE_ROUTER option for Backbone Router function.
- Implement Backbone Router service registration.
  - Add basic Backbone Router service.
  - Primary Backbone Router restores its Dataset when reattached after
    short reset, increases sequence number and re-register to Leader.
  - Add configurable jitter for Backbone Router service registration.
- Add Backbone Router service test.
2020-03-26 08:54:23 -07:00
Yakun Xu 6606f2befe [posix] rename namespace to posix (#4736)
This commit simply renames namespace of PosixApp to Posix.
2020-03-25 23:19:27 -07:00
Abtin Keshavarzian 234c263be0 [posix] move core config options from cmake file to the header file (#4713)
This commit moves the OpenThread core config definitions (like
`OPENTHREAD_CONFIG_LOG_OUTPUT`) from the `CMakeLists.txt` file into
the `openthread-core-posix-config.h`. This help allow a project/user
specific config header file to override the default config definition
(e.g., toranj config for posix).
2020-03-25 22:38:51 -07:00
Jonathan Hui c15664bccd [github-actions] add simulation checks (#4735) 2020-03-25 19:52:22 -07:00
Jonathan Hui 2de22eb079 [travis] disable build checks that exist in GitHub actions (#4731) 2020-03-25 19:29:31 -07:00
Diego Ismirlian b64d148b97 [flash] improve power failure robustness (#4717)
This commit improves the flash implementation robustness to power
failure. The idea is the following:

The Init method now checks if a record has been partially written by
seeing if the kFlagAddBegin flag is set, but the kFlagComplete flag is
not. In this case, Init stops incrementing mSwapUsed. The new
SanitizeFreeSpace method checks the (supposedly) free space, to see if
it is writeable. If it isn't, it triggers a Swap, which sanitizes the
flash area.
2020-03-25 17:18:21 -07:00
Simon Lin 2ef2fb1717 [meshcop] fix commissioner's invalid call to SetState (#4494)
Commissioner should not call SetState(OT_COMMISSIONER_STATE_DISABLED)
directly, rather it should call Stop() so that joiners and resources
are cleaned up.

This commit:

- Fixes the above issue.

- Adds argument name /* aResign */ to Stop() calls.

- Ignores petition/keep-alive response if commissioner is not in
  PETITION/ACTIVE state.

- Calls CoapSecure::Stop when Start fails (suggested by @bukepo).

- Responds to Leader Petition Response (accept) by sending
  KeepAlive(reject) if commissioner is in disabled state.
2020-03-25 14:42:44 -07:00
Jonathan Hui db22529c27 [mle] combine FTD/MTD header files into one (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui 365ea0d2a8 [mac] remove rx-only neighbors from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui 9c69ad077d [network-diagnostic] remove Max Child Timeout TLV from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui 543dba995c [network-diagnostic] remove Connectivity TLV from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui 1850152029 [ip6] remove IPv6 multicast forwarding to sleepys from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui d44f75112a [child-table] remove from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui fbd27e3cb5 [src-match-controller] remove from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui d00f9f7228 [router-table] remove from MTD build (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui efa085e43f [mle] avoid unnecessary method calls on MTD (#4730) 2020-03-25 07:54:57 -07:00
Jonathan Hui 4cb09ec637 [continuous-integration] initial migration to GitHub actions (#4728) 2020-03-24 20:45:19 -07:00
Jonathan Hui 35bb0027d0 [network-data] avoid comparison of narrow type with wide type in loop (#4724) 2020-03-24 11:09:20 -07:00
Jonathan Hui c136ac2029 [coap] avoid comparison of narrow type with wide type in loop (#4724) 2020-03-24 11:09:20 -07:00
Jonathan Hui 2b11826fbe [lowpan] do not try to compress large extension headers (#4724) 2020-03-24 11:09:20 -07:00
Yakun Xu cb55c530bd [cmake] clean up cmake options (#4727)
* enable optional features
* remove OT_NCP
* remove OT_NCP_RADIO_ONLY
* sort options
2020-03-24 07:29:48 -07:00
Jonathan Hui 322359fd88 [lowpan] avoid backward goto statement in Compress() (#4725) 2020-03-24 07:25:53 -07:00
Jiacheng Guo c03edff16b [posix] add platformNetifDeinit (#4726)
Close netif file descriptors to re-open after reset.
2020-03-23 23:28:54 -07:00
Jonathan Hui c87665f0d5 [mesh-forwarder] avoid unnecessary comparisons on ALOC (#4723) 2020-03-23 21:00:40 -07:00
Jonathan Hui 72a2725ecd [meshcop] add explicit length check in MGMT_GET.req (#4721) 2020-03-23 21:00:20 -07:00
Jonathan Hui 756824b5fa [mpl] make MplSeedEntry private to Mpl (#4715) 2020-03-23 20:59:41 -07:00
Jonathan Hui 2738b05af7 [mpl] make MplBufferedMessageMetadata private to Mpl (#4715) 2020-03-23 20:59:41 -07:00
Jonathan Hui 6c365287e7 [mpl] remove retransmission logic from MTD build (#4715) 2020-03-23 20:59:41 -07:00
Jonathan Hui 8eeb1e83eb [cli] change aArgsLength type from int to uint8_t (#4718) 2020-03-23 00:12:09 -07:00
Jonathan Hui a6a93d688d [cli] change 'argc' -> 'aArgsLength', 'argv' -> 'aArgs' (#4718) 2020-03-23 00:12:09 -07:00
Jonathan Hui ecf90d281e [network-data] use explicit signed int for bit field (#4720) 2020-03-23 00:10:31 -07:00
Jonathan Hui 2f63f74693 [thci] remove unused assignments (#4719) 2020-03-23 00:09:13 -07:00
Jiacheng Guo 5a82d90e4d [netif] enhance return value of adding external addresses (#4693)
This commit changes the return value of subscribing a pre-defined
address when it's already subscribed. Now returns OT_ERROR_ALREADY
instead of OT_ERROR_INVALID_ARGS.
2020-03-21 15:40:14 -07:00
Rongli Sun f60a5295fc [ip6-address] add GetLocator() and SetLocator() (#4707) 2020-03-21 10:08:16 -07:00
Piotr Koziar b403fb9f9c [nrf528xx] update README.md (#4716) 2020-03-20 15:05:37 -07:00
Jonathan Hui c6adc8ce45 [cc1352,cc26xx] include -pedantic-errors in platform code (#4714)
- Also fix a pointer arithmetic issue that was flagged.
2020-03-20 08:42:09 -07:00
Abtin Keshavarzian 91b654ba6e [travis] add build checks for cmake with toranj configs (for simul/posix platforms) (#4712) 2020-03-20 08:41:38 -07:00
Abtin Keshavarzian 61b4c5a2af [toranj] define platform specific config headers (#4712)
This commit adds platform specific config header for simulation
and posix platforms for toranj. The common configuration definition
stay in the `openthread-core-toranj-config.h` and are shared for all
platforms. The `build.sh` script is also updated to pick the correct
platform-specific config header for both cmake or autoconf builds.
2020-03-20 08:41:38 -07:00
Diego Ismirlian 8e31a6ad79 [efr32] flash: fixes for new otPlatFlash* abstraction (#4711)
- Fully erase the swap region (not only the first page in swap).

- Remove waiting loop after MSC_ErasePage. The SDK MSC functions
  already wait for the operation to finish.

- Avoid unlocking the flash before the actual write/erase
  operation. The SDK MSC functions already do the unlock/re-lock when
  needed.
2020-03-20 08:40:05 -07:00
Abtin Keshavarzian 6290f577b5 [coap-message] add Coap::MessageQueue class (#4701)
This commit adds `Coap::MessageQueue` class as a subclass of generic
`ot::MessageQueue` as a queue of `Coap::Message` only. This type is
used in `coap.cpp` helping simplify the code (by removing the type
casting).
2020-03-20 00:00:17 -07:00
Rongli Sun 736cb27d3a [script] let alias to take effect (#4708) 2020-03-19 22:24:03 -07:00
kangping 133ec09b80 [cli] return OT_ERROR_INVALID_ARGS for invalid arguments (#4639)
- Remove argument parsing failure from semantic of OT_ERROR_PARSE.

- Add OT_ERROR_INVALID_COMMAND to indicate invalid CLI command error.

- return OT_ERROR_INVALID_ARGS for invalid CLI arguments.
2020-03-19 10:51:42 -07:00
kangping db765d9370 [build] fix typo in CMake files (#4704) 2020-03-19 09:27:12 -07:00
Jonathan Hui baca06f06b [utils] remove example flash implementation (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 77a9ec594a [cc2650] enable RAM settings by default (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 26737a89a2 [samr21] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui f33b47e151 [kw41z] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui f86438e740 [efr32mg21] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui df5f08b135 [efr32mg13] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 64ac0ff38d [efr32mg12] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 2dcbd3926c [cc2652] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 46d790c442 [cc1352] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 7d323b30bf [nrf528xx] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui d52b3a3032 [cc2538] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 8921feff4c [posix] implement otPlatFlash APIs (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 8220981b6e [flash] integrate flash driver with build option (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui b3d05af6ff [flash] implement flash storage driver for settings (#4552) 2020-03-18 20:51:41 -07:00
Jonathan Hui 4ee8010558 [script] update make-pretty to bash (#4698)
- Also update CONTRIBUTING.md and STYLE_GUIDE.md.
2020-03-18 19:04:10 -07:00
Piotr Koziar ccf4eb9a51 [nrf528xx] fix IAR undefined order of volatile accesses error (#4702)
Fixes IAR compiler warning: "warning[Pa082]: undefined behavior: the
order of volatile accesses is undefined in this statement"
2020-03-18 19:03:50 -07:00
Abtin Keshavarzian 7456be9e80 [coap] use Coap::Message helper methods checking CoAP type (#4700)
This commit change code to use `IsConfirmable()`,
`IsNonConfirmable()`, `IsAck()` helper methods.
2020-03-18 12:18:09 -07:00
Piotr Koziar ab9c0a4091 [nrf528xx] move transport config to a separate file (#4695) 2020-03-17 16:11:39 -07:00
Piotr Koziar a144ff653e [nrf528xx] changed deprecated flash write call (#4699) 2020-03-17 15:47:06 -07:00
Rafał Kuźnia 661d2b4f5f [mac] add capability to transition from Sleep to Transmit during data request (#4697) 2020-03-17 13:02:15 -07:00
Jiacheng Guo cecf203388 [nrf528xx] add volatile mark to nrf uart read/write buffers (#4652)
These buffers are touched in volatile and should be marked as volatile.
2020-03-17 10:06:30 -07:00
Robert Lubos 0c34c42043 [cmake] fix build with external mbedTLS (#4696)
`mbedcrypto` target is only available when `OT_BUILTIN_MBEDTLS` is set,
therefore linking it unconditionally when external mbed TLS instance is
used results in a linking error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-17 10:03:06 -07:00
Abtin Keshavarzian bf1cf97b0f [coap] ensure correct dequeue time for entries in response queue (#4686)
This commit changes the handling of timer for CoAP response queue to
ensure that correct dequeue time is used. The existing code assumed
that entries in the queue would be in order of their dequeue time (due
to exchange lifetime being fixed). With the addition of configurable
CoAP tx parameters feature, this is no longer valid. This commit
changes the code to restart the timer with the earliest dequeue time.
Also when evicting a message from the queue (due to the number of
entries reaching the max limit of `kMaxCachedResponses`) we now search
and find the message with earliest dequeue time to remove (instead of
removing the entry at the head of queue).
2020-03-16 09:08:43 -07:00
Abtin Keshavarzian 1d463868d9 [coap] directly initalize metadata before appending to message (#4686) 2020-03-16 09:08:43 -07:00
Jonathan Hui 6a277399e1 [dhcp6] use Ip6::Address::SetPrefix() (#4685) 2020-03-16 08:56:17 -07:00
Abtin Keshavarzian 2bb72299d3 [mle] define ResponseHeaderMetadata as inner type of Mle class (#4683)
This commit also simplifies `Header` class methods and moves its `enum`
definitions to the top of class.
2020-03-14 09:26:03 -07:00
kangping a495dea4ac [tests] initialize _initialized (#4662)
This commit initializes _initialized of Node before doing
initialization. Otherwise, we will have an AttributeError in
desctructor when initialization fails.
2020-03-13 22:16:32 -07:00
Abtin Keshavarzian ab81a256e4 [mle-types] add MeshLocalPrefix class (#4679) 2020-03-13 22:06:04 -07:00
Abtin Keshavarzian 052047a15f [mle] adding LeaderData class (#4679)
This commit adds `LeaderData` (subclass of `otLeaderData`) to store
the info from Leader Data TLV. It also adds `ReadLeaderData()` to
read Leader Data TLV from a message.
2020-03-13 22:06:04 -07:00
Abtin Keshavarzian 54e884569b [mle-types] adding new files mle_types.hpp/cpp (#4679)
The newly added `mle_types.hpp/cpp` files include MLE specific types
(e.g. `DeviceMode`) and constants.
2020-03-13 22:06:04 -07:00
Abtin Keshavarzian 9e1020c52f [meshcop-tlvs] remove "using ot::Encoding::Reverse32" (#4682) 2020-03-13 22:00:58 -07:00
doru91 63c4dbbc2b [examples] add NXP JN5189 platform (#4642)
This commit contains all the new files required by the JN5189 platform as well as
the implementation of the platform files required by OpenThread.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
2020-03-13 12:03:18 -07:00
Abtin Keshavarzian 9a7d831cb1 [ip6-address] adding SetPrefix() to set the IPv6 address prefix (#4677)
This commit adds a new method `SetPrefix()` in `Ip6::Address` class to
 allow the prefix in an IPv6 address to be updated. Unit test
`test_ip6_address` is updated to verify behavior of new method. The
`Mle` and `Lowpan` classes are updated to use the new `SetPrefix()`
method.
2020-03-13 08:07:07 -07:00
Piotr Koziar 3884f05739 [nrf528xx] separate transport from platform (#4673)
Transport-related functions for nrf528xx platform are moved to separated library.
2020-03-13 07:39:20 -07:00
Abtin Keshavarzian e56621118f [network-data] fix/update comments on prefix length being in bits (#4678) 2020-03-12 21:21:05 -07:00
Li Cao 3b15b67886 [tests] fix logic error in net_crypto.py (#4675) 2020-03-12 08:41:50 -07:00
Abtin Keshavarzian dc2f9edcb7 [key-manager] add Kek class (#4674)
This commit adds a class `Kek` to store Key Encryption Key
2020-03-12 08:41:00 -07:00
Yakun Xu 08c7113336 [test] build with cmake instead of automake (#4653)
- Use cmake to build.
- Use rcp instead of transceiver simplicity.
- Add virtual time options for cmake.
- Enable readline support for posix apps.
- Use ninja instead of make.
2020-03-12 08:40:23 -07:00
Abtin Keshavarzian 5903117da5 [debug] adding OT_ASSERT() macro (#4665)
This commit adds a new OpenThread specific `OT_ASSERT()` macro along
with a new config OPENTHREAD_CONFIG_ASSERT_ENABLE option which allows
the assert to be enabled or disabled. This allows a release build to
consider disabling the assert reducing code size. This commit also
adds a new travis (simulation platform) build with asserts disabled.
2020-03-11 17:30:41 -07:00
Abtin Keshavarzian 587cb7fb30 [mle] use operator when comparing Extended PAN IDs (#4669) 2020-03-11 15:03:41 -07:00
Jonathan Hui c77342e5cc [energy-scan] avoid buffer overrun when receiving energy results (#4672) 2020-03-11 11:52:36 -07:00
Jonathan Hui 3530fc5907 [fuzz] implement radio state transitions (#4671) 2020-03-11 11:43:43 -07:00
Jonathan Hui 415c42da57 [coap] avoid div-by-0 error in validating coap params (#4670) 2020-03-11 11:43:28 -07:00
Yakun Xu 653745911f [build] rename posix-app to posix (#4661) 2020-03-11 11:42:30 -07:00
Yakun Xu 34b83ae6c5 [script] simplify pretty (#4660)
* No need to bootstrap and configure for make pretty
* Use parallel to speed up make pretty
2020-03-10 22:15:07 -07:00
Abtin Keshavarzian e81562f182 [joiner-router] prepare Joiner Entrust msg after the delay (#4657)
This commit simplifies the `JoinerRouter` implementation. It moves
`JoinerEntrustMetadata` as a private inner type of `JoinerRouter`. It
also changes how the tx of Joiner Entrust is delayed. Instead of
preparing the message (and appending metadata to it) and enqueuing it
to be sent later after a delay, only the metadata is saved and the
Joiner Entrust message is prepared after the delay (when it is being
sent).
2020-03-10 19:15:35 -07:00
Zhanglong Xia 27ec1a7648 [posix-host] use MultiFrameBuffer as SPI receive buffer (#4577)
This commit improves MultiFrameBuffer so that MultiFrameBuffer can
reserve a space in front of the frame. SPI interface uses
MultiFrameBuffer to store received frame directly, which avoids
copying data from receive buffer to MultiFrameBuffer.
2020-03-10 19:13:23 -07:00
Pratik Raj 2e09531745 [script] optimization debian package manager tweaks (#4656)
By default, Ubuntu or Debian based "apt" or "apt-get" system installs
recommended but not required packages.

By passing "--no-install-recommends" option, the user lets apt-get
know not to consider recommended packages as a dependency to install.

This results in smaller downloads and installation of packages.

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
2020-03-10 15:34:22 -07:00
Simon Lin b5b97ae43b [ncp] notify wpantund when RLOC changes (#4659)
* notify wpantund when RLOC changes

* change not matched flag ex to OT_CHANGED_SECURITY_POLICY
2020-03-10 08:55:25 -07:00
Abtin Keshavarzian c7bcdb9360 [toranj] make test-13-off-mesh-route more robust (#4658)
This commit changes the test to wait till network data is updated
on `r1`, `r2`, and `sed2` nodes and they all see all the added
off-mesh routes (instead of waiting for fixed 0.5 seconds).
2020-03-10 08:54:41 -07:00
Rongli Sun 5d12c6247f [cli] add preferrouterid command (#4647) 2020-03-09 18:33:55 -07:00
Abtin Keshavarzian e41fec73cb [meshcop-tlvs] simplify processing of simple MeshCoP TLVs (#4635)
This commit changes the processing of the following TLVs: PAN ID,
Extended PAN ID, PSKc, Network Master Key, Network Key Sequence, Mesh
Local Prefix, Border Agent Locator, Commissioner Session ID,
Commissioner UDP Port, State, Joiner UDP Port, Joiner IID, Joiner
Router Locator, Joiner Router KEK, Delay Timer, Count, Period, Scan
Duration, and IP6 Address.
2020-03-09 11:39:09 -07:00
Abtin Keshavarzian 39b796fa52 [thread-tlvs] simplify processing of simple Thread TLVs (#4635)
This commit changes the processing of the following TLVs: RLOC16,
Thread Status, Thread Last Transaction Time, Thread Extended MAC
Address, Thread Target, and Mesh Local EID.
2020-03-09 11:39:09 -07:00
Abtin Keshavarzian 15d5644b7d [mle-tlvs] simplify processing of simple MLE Tlvs (#4635)
This commit changes the processing of the following MLE TLVs:
SourceAddess, Mode, Timeout, LinkFrameCounter, MleFrameCounter,
Address16, LinkMargin, Status, Version, PanId, XtalAccuracy, ScanMask,
NetworkData, Challenge, Response, and TlvRequest.
2020-03-09 11:39:09 -07:00
Abtin Keshavarzian 19ed02842c [tlv] add helper read/append methods for TLVs with simple types (#4635)
This commit adds helper static methods in `Tlv` class to directly read
the value of simple TLVs from a `Message`, or append a simple TLV to a
message. The simple TLVs are the ones with single unsigned integer
value (e.g., MLE Frame Counter TLV, MeshCop Scan Duration TLV, etc),
or a value that can be treated as an array of bytes (e.g., MeshCop
PSKc TLV, etc).
2020-03-09 11:39:09 -07:00
kangping c54238fdd6 [network-diagnostic] fix sed capacity when skipped in Connectivity Tlv (#4654) 2020-03-09 09:19:17 -07:00
rob-the-dude dcfc0bca13 [posix] NetBSD is also missing util.h (#4651) 2020-03-09 09:15:37 -07:00
Yakun Xu 56d0e7212b [mac] add enhanced frame pending (#4334)
This commit adds enhanced frame pending feature of Thread 1.2. This
requires the platform radio driver to correctly set frame pending bit
for Data frames and MAC Data Request frames.
2020-03-09 09:08:46 -07:00
Rongli Sun fdcb8553b1 [network-data] fix stable version update issue for service (#4645) 2020-03-07 19:36:40 -08:00
Rongli Sun 9e4f9933be [network-data] fix to ensure resubmit delay (#4644)
Fix bug introduced in 5ebc583 when changing from VerifyOrExit to if.
2020-03-06 20:09:18 -08:00
Yakun Xu 9c6df6e541 [tests] remove unused self in map_pp (#4643) 2020-03-06 20:07:48 -08:00
Piotr Koziar b99f8293f9 [coap] enum type conversion to int in otCoapBlockSizeFromExponent (#4631)
This commit fixes an "enumerated type mixed with another enumerated
type" error during IAR compilation.
2020-03-06 20:06:09 -08:00
Li Cao f9ad60600e [android] add switch to use SPI in Android.mk (#4626) 2020-03-06 20:04:58 -08:00
Yakun Xu d77292ccc4 [posix] log version on start (#4620) 2020-03-06 20:04:10 -08:00
Jonathan Hui a75b412ecf [settings] fix bootloop when more than 255 ChildInfo entries are stored (#4640)
In MleRouter::RestoreChildren() there is an iteration over all
ChildInfo items. This iterator uses mIndex which is uint8_t and in our
case its value wraps causing infinite loop. Changing mIndex to
uint16_t fixes this issue.
2020-03-05 14:13:37 -08:00
Jonathan Hui 225f9b58eb [cmake] allow configuration of NCP defines (#4633)
Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-03-05 11:07:10 -08:00
Jonathan Hui f88588e4b0 [tests] enhance matching pattern (#4629)
This commit enhances the way to match patterns during tests, so that
it can also support with readline enabled.
2020-03-05 09:59:17 -08:00
Jonathan Hui b19d2cc8ce [meshcop] simplify Timestamp TLV Get/Set 48-bit seconds value (#4638) 2020-03-05 09:55:03 -08:00
Abtin Keshavarzian 6e992e1f3e [toranj] update build script to add option for posix host using cmake (#4637) 2020-03-05 09:18:57 -08:00
Abtin Keshavarzian 62e781d63a [cmake] update posix-host cmake to allow OT_CONFIG option to be specified (#4637)
This commit changes the `CMakeLists.txt` for posix host platform to
allow the OpenThread config header file to be specified through the
`OT_CONFIG` option. Similar to other platforms, if no config header is
provided the platform can choose to provide a default one (in the
posix host case we use "openthread-core-posix-config.h" as the
default).
2020-03-05 09:18:57 -08:00
Jonathan Hui b2866e26a1 [travis] enable most build features in cmake build check (#4636) 2020-03-05 09:17:36 -08:00
Jonathan Hui 708aea8c8c [cmake] add OT_PRIVATE_DEFINES to platform lib build (#4636) 2020-03-05 09:17:36 -08:00
Jonathan Hui 36e51132c8 [tests] fix 1.2 test env and travis (#4614) 2020-03-04 20:17:56 -08:00
Jonathan Hui bc60ff5e96 [spinel] change spinel.h output dir include/spinel (#4634) 2020-03-04 10:38:45 -08:00
Jonathan Hui 2b828c164b [script] make pretty python or clang (#4632)
Reformating cpp

```bash
./script/make-pretty clang
```

Reformating python

```bash
./script/make-pretty python
```
2020-03-04 10:23:00 -08:00
Jonathan Hui afe57bf36d [fuzz] implement transmit radio callbacks (#4625)
- otPlatRadioTxStarted
- otPlatRadioTxDone
2020-03-04 10:20:10 -08:00
Jonathan Hui 50a06f80a1 [fuzz] transition fuzz_platform to cpp (#4625) 2020-03-04 10:20:10 -08:00
Yakun Xu 6614d14c34 [coap] reduce code size by avoiding using 64bit division (#4612)
- Removed OpenThread's default CoAP configuration macro, because they
  are fixed values by Thread spec.

- Use 32bit multiple only to detect overflow of application CoAP
  transmission parameters.

- Added documentation describing conditions of valid CoAP transmission
  parameters.
2020-03-03 22:59:56 -08:00
Tobías Lifschitz a802bfb0f3 [coap] change CoAP option data type to uint16_t in C/C++ API (#4621) 2020-03-03 10:12:07 -08:00
Ciaran Woodward e29e14b4fd [docs] fix outdated priority comment in message.hpp (#4627)
Since the priority levels were inverted in #3132, this comment was incorrect.
2020-03-03 09:05:55 -08:00
Jing Ma 6b8a77502d [travis] delete null OT_NCP_PATH in check-posix-app-pty (#4628) 2020-03-03 09:04:05 -08:00
Simon Lin 150aa9b6db [network-data] add source address of SVR_DATA.ntf check (#4602) 2020-03-02 22:39:34 -08:00
Abtin Keshavarzian fc6ca182d3 [cmake] fix RCP cmake build to not include FTD/MTD source files (#4624) 2020-03-02 22:00:31 -08:00
Zhanglong Xia 7f25092938 [git] ignore temporary swap files created by editor (#4618) 2020-03-02 17:58:07 -08:00
Jeff Bumgardner 688ae774aa [docs] update Doxygen for otMacCounters (#4622) 2020-03-02 14:52:59 -08:00
Eduardo Montoya 15f6808206 [cli] allow to escape separators (#4608) 2020-03-02 08:48:31 -08:00
Yakun Xu f4775fe13a [build] enhancements for OpenThread border router (#4604)
This commit makes a few small changes so that the cmake build files
can be used by project depending on this project.
2020-02-28 22:08:02 -08:00
Jonathan Hui 5b622e690e [typos] fix typos (#4613) 2020-02-28 21:45:04 -08:00
kangping 8ab37df1a7 [mle] improve readability of RouteTlv (#4610)
This commit increases readability of RouteTlv APIs, such as uint8_t
GetRouteCost(...). The argument of GetRouteCost is the index of route
in mRouteData, but not the Router ID.

This commit contains no logic changes.
2020-02-28 08:39:35 -08:00
Diego Ismirlian 8c34040d74 [efr32] Radio: don't abort current operation on switching to idle (#4586) 2020-02-28 08:31:36 -08:00
Yakun Xu c36fa453f1 [travis] move package check into lint stage (#4603)
This commit moves the package check into the first stage so that if
there are some build errors jobs in stage 2 will be skipped.
2020-02-27 21:55:30 -08:00
Stuart Longland 98f930c793 [coap] add support for RFC7641 (#4396)
* [coap] Add option scanning functions

In a few places in the OpenThread code-base, the following construct is
seen:

```
    otCoapOptionIterator iterator;
    otCoapOptionIteratorInit(&iterator, message);

    for (const otCoapOption *opt = otCoapOptionIteratorGetFirstOption(&iterator);
                             opt != NULL;
                             opt = otCoapOptionIteratorGetNextOption(&iterator))
    {
        if (opt->mNumber == OT_COAP_OPTION_DESIREDOPTION)
        {
            doSomethingWith(opt);
            break;
        }
    }
```

or its equivalent.  In cases where multiple options are sought, the
above is still the better approach (using a `switch` statement), but
otherwise this seems repetitive.

`otCoapOptionIteratorGetFirstOptionMatching` basically implements the
above loop, returning the first option that matches.  This same code can
also be used for testing for presence too by comparing the resultant
pointer to the `NULL` singleton.

For completeness in cases where a software developer may want to
*resume* looking for further matching options,
`otCoapOptionIteratorGetNextOptionMatching` is also provided.

* [coap] Add function for decoding Uint options

To properly implement features such as RFC7641 and RFC7959, one must be
able to decode unsigned integer options.  It seems silly to have an
encoder but not a decoder, so here is the missing piece.

Future considerations may be a `uint32_t` version since the majority of
use cases do not call for a `uint64_t`; the type was chosen since it was
the most general case.

* [coap] Reference the RFC for the Observe option.

For the sake of completeness, reference the relevant RFC in the
documentation so that developers can read up more on how it should work.

* [coap] Add mObserve flag to metadata.

When we're implementing observations, a few exceptions to the usual CoAP
conventions apply, notably:

- when we receive the initial reply, the request is _not_ finished, we
  will receive subsequent requests until we tell the server to stop.
- when we send a confirmable notification, the observing client will
  reply with an `ACK` with no further traffic: we need to differentiate
  this from an empty `ACK` to a request meaning we should expect a reply
  later.

While we could just repeatedly scan for the `Observe` option on the
request, that is wasteful in terms of processing time.  This allows us
to scan the request just once, and set a single-bit flag to save
processing later.

* [coap] Don't expect traffic after ACK to notification

If the client sends an empty `ACK` in reply to a confirmable RFC7641
notification, we will _NOT_ see further replies with additional
information.  Consider the notification as acknowledged and pass the
details back to the application.

* [coap] Pass through notifications to handler

Ensure that all notifications sent by the CoAP server are passed back to
the application's CoAP request handler.  When we receive the first one,
the request continues -- it does not finish until the server drops the
`Observe` flag or we tell the server to stop.

* [coap] Disable expiry timer once subscribed

If a request carries `Observe=0` and we receive the first reply, ignore
future time-out events as the transaction will finish only when
explicitly terminated.

* [coap] Support eager subscription cancellation

A CoAP client may signal its intention to unsubscribe from a resource by
sending a `GET` request with a token matching that of the original
request and setting the `Observe` option to the value 1.

In the event the application does this, we should pick this up and
cancel the pending transaction locally.  The handler will be notified of
this by a final call where `aError=OT_ERROR_NONE` and no message given.

* [cli] Add RFC7641 support to CLI example

As an aide to those developing code that uses RFC7641, implement an
example client and server that supports this feature.
2020-02-27 21:46:43 -08:00
Matteo Paris 904719079d [dtls] fix allocation and deallocation of ssl cookies (#4564) 2020-02-27 20:19:40 -08:00
Yakun Xu a613ff0ee4 [posix] fix handling SPI interrupts (#4607)
When SPI is already interrupted before select(), the wait timeout will
be set to 0, and select() will return 0 immediately if there are no
new events. As a result, cause an incorrect OT_ERROR_RESPONSE_TIMEOUT
error.

This commit fixes this issue by check if data is ready before checking
the select() result.
2020-02-27 17:56:08 -08:00
Yakun Xu a551133493 [build] rename example platform POSIX to simulation (#4555)
Having examples/posix and src/core/posix is confusing. This commit
renames the examples posix platform to simulation.
2020-02-27 12:55:56 -08:00
Yakun Xu fb16fd44d7 [build] move hdlc to lib/hdlc (#4590)
This commit moves hdlc from src/ncp to src/lib/hdlc, src/spinel is also
moved to src/lib/spinel.
2020-02-27 08:49:01 -08:00
kangping acc24cef18 [network-diagnostic] declare ExtMacAddressTlv as packed (#4606) 2020-02-27 08:31:21 -08:00
Yakun Xu 03dc380ef5 [posix-host] include inttypes.h in spi_interface.cpp (#4605)
On some platforms, inttypes.h is not included by other headers.
2020-02-27 08:29:47 -08:00
Yakun Xu e13c06e192 [mac] fix macro typo (#4601) 2020-02-26 20:49:44 -08:00
Yakun Xu 91b0dba2a0 [posix-host] fix warnings caused by SPI arguments (#4596)
* signed/unsigned conversion error
* undefined behavior of embedding macros in string literal
2020-02-26 09:49:46 -08:00
Yakun Xu a90246b760 [build] make OpenThread POSIX deb packages (#4592)
This commit enables building OpenThread deb packages:

* openthread-simulation: simulation of OpenThread
* openthread-daemon: daemon of OpenThread Host
* openthread-standalone: standalone binaries of OpenThread Host
2020-02-25 18:20:14 -08:00
Rongli Sun b339a8946b [travis] test parent selection rules (#4423)
This commit has five scenarios to test the four Mesh Impacting
Criteria and one Child Impacting Criterion (version).
2020-02-25 14:34:53 -08:00
Rongli Sun 835d9e2505 [mle] update parent selection rulesi (#4423)
This commit updates parent selection rules according to Thread 1.2
Specification section 4.5.2.1, which supplements serveral Child Impacting
rules to existing rules defined in Thread 1.1 Specification.

These additional rules are not wrapped by `OT_THREAD_VERSION_1_2'
macro as Thread 1.1 has no restrictions regarding introducing extra rules.
2020-02-25 14:34:53 -08:00
Abtin Keshavarzian c32a0ee561 [coap] misc enhancements and simplifications (#4554)
This commits contains the following changes:
- Declare `Metadata` as a private inner class of `CoapBase`. Also
  replace constructors with `Init()` method and removes the default
  empty constructor (since it is not needed).
- Add `ResponseMetadata` as private inner struct in `ResposeQueue`.
- Simplify `ResponsesQueue::FindMatchedResponse()`.
- Declare `CoapBase::Sender` as a protected type.
- Use initializer list in `CoapBase` constructor.
- Use `for` loop for iterating over messages in a message queue.
- Define `ResponseHandler` and `RequestHandler` types.
- Update `TxParameters` class. Add helper method for common
  calculation of span window, and remove unused constant definitions.
- Move more complex method implementation from header file into
  `cpp` file (helps reduce code size).
- Update comments and documentations.
2020-02-25 11:59:10 -08:00
Jonathan Hui fe6a7e1493 [cli] adjust arg length checking to 'coap parameters' (#4595) 2020-02-25 06:39:02 -08:00
Jiacheng Guo 9a4098fdb5 [posix-host] enable platform udp/netif by default in daemon mode (#4568) 2020-02-24 22:16:48 -08:00
Yakun Xu b01754cabf [mle] add enhanced keep-alive (#4325)
This commit introduces the first Thread 1.2 feature - enhanced keep
alive.

This commit also introduces the build config
OPENTHREAD_CONFIG_THREAD_VERSION to include/exclude Thread 1.2 code.
2020-02-24 21:03:19 -08:00
Yakun Xu ff3033f24f [posix-host] die on RCP timeout (#4591)
When RCP fails to respond in time, it usually means RCP is stuck or in
some bad situations that can only recover by hardware resetting. This
commit changes the behavior on RCP timeout so that RCP can be reset
during the host daemon restarting.
2020-02-24 20:58:34 -08:00
Yakun Xu 24a24f1f9e [build] move openthread-system.h under openthread (#4593)
This commit moves openthread-system.h to a directory named openthread
so that projects depends on OpenThread can use it without installing
OpenThread project.
2020-02-24 13:16:03 -08:00
Rongli Sun 87126b2b59 [router-table] exit earlier when GetRouter() for invalid router id (#4485) 2020-02-24 13:13:01 -08:00
Rongli Sun d20db6eb40 [service] fix the minimum cost server selection (#4485) 2020-02-24 13:13:01 -08:00
Rongli Sun 8d9655a282 [network-data] deregister stale network data when receiving packet destined to ALOC (#4485)
This commit assists the previous commit to help to remove invalid
server entry in some extreme scenario, for example if child server
switches parent in a Thread Network with packet loss, and
  a) SRV_DATA.ntf from the old parent to deregister fails
  b) the first attempt of SRV_DATA.ntf from the child fails
When the child tries to resend SRV_DATA.ntf due to network data inconsistence,
there will be no old rloc16, that is, the network data may have invalid server entry.

Though previous commit introduces the invalid child server detection when there is
new network data, however if the deregister there fails and there is no new
network data further, there is chance there invalid server entry would
stick there.
Here provides one invalid child server detection and recover mechanism
according to the ALOC destined traffic.
2020-02-24 13:13:01 -08:00
Rongli Sun b2a845947e [network-data] deregister for invalid child on new network data (#4485) 2020-02-24 13:13:01 -08:00
Rongli Sun 2bc32a36d1 [network-data] introduce 5s delay between SRV_DATA.ntf when deregister for child (#4485) 2020-02-24 13:13:01 -08:00
Rongli Sun b2024b8153 [network-data] ensure DATA_RESUBMIT_DELAY between SRV_DATA.ntf (#4485) 2020-02-24 13:13:01 -08:00
Rongli Sun 4bf95c6c7b [network-data] remove ClearResubmitDelayTimer() in UpdateRloc() (#4485)
`UpdateRloc()`, which happens before checking network data consistence,
should not `ClearResubmitDelayTimer()` to guarantee the DATA_RESUBMIT_DELAY
before resending when there is inconsistence.
2020-02-24 13:13:01 -08:00
Rongli Sun 530631fee9 [network-data] reuse mLastAttempt for the function of mLastAttemptWait (#4485)
This enhancement is based on that `mLastAttempt` with value `0` is
equivalent to `mLastAttemptWait` with value `false`
2020-02-24 13:13:01 -08:00
Rongli Sun ea29b88f78 [coap] clear cached coap requests with rloc source when rloc changes (#4485)
This commit helps to reduce unnecessary CoAP retransmission when rloc
changes. When comes to SRV_DATA.ntf, it also helps to avoid invalid
network data registration. Take the issue reported in #4472 as example,
in a Thread Network with packet loss, the child server may switch parents
frequently, there might be cached SRV_DATA.ntf including old rloc16,
both the cached one and new one might be sent after switched, causing
Leader improperly contain two server entries in the Network Data.
2020-02-24 13:13:01 -08:00
Thomas 206da76b26 [gp712] fix build error due to conditional include of cfmakeraw (#4594) 2020-02-24 09:45:01 -08:00
Jonathan Hui 2dec88fc41 [coap] validate token length on received messages (#4584)
Per RFC 7252:

- Treat invalid token length as a message format error.

- Rejecting a Confirmable message is effected by sending a matching
  Reset message and otherwise ignoring it.
2020-02-24 09:19:22 -08:00
Diego Ismirlian 67f33091f0 [coap] make transmission parameters dynamically configurable (#4481) 2020-02-21 16:07:48 -08:00
Jonathan Hui 167d616bc2 [network-data] avoid buffer overflow in HandleCommissioningSet() (#4583)
Reject Commissioner Dataset TLVs with extended TLV length.
2020-02-21 11:17:05 -08:00
Jonathan Hui ea09b6e064 [fuzz] fix fuzzer platform build (#4583) 2020-02-21 11:17:05 -08:00
Yakun Xu cec297475f [build] fix command t not found (#4588)
There may be some bug in automake when computing dependencies,
causing output error messages as following when installing:

```bash
/bin/bash: t: command not found
```

This issue is introduced in #4558.
2020-02-21 09:25:46 -08:00
Marven Gilhespie f81384f785 [efr32] added suffixes to BSP CLK constants hal-config.h to match SDK (#4585) 2020-02-21 09:21:21 -08:00
Diego Ismirlian f8b8b24b6f [posix-host] ot-cli: handle write() return values (#4580) 2020-02-21 09:18:59 -08:00
Li Cao 8fcdcf6fd3 [test] fix check error, cast non-trivial class pointer to void * (#4579) 2020-02-20 09:38:43 -08:00
Abtin Keshavarzian 5cddf90389 [link-quality] remove aNoiseFloor param from LinkQualityInfo methods (#4569) 2020-02-20 09:36:34 -08:00
Abtin Keshavarzian 2437a75a6b [link-quality] have LinkQualityInfo inherit from IntsanceLocatorInit (#4569) 2020-02-20 09:36:34 -08:00
Abtin Keshavarzian 0f5edc4c89 [child] remove instance parameter from Ip6Address related methods (#4569)
Remove the now unnecessary `aInstance` parameter in `Child` methods
(since `Child` is now itself an `InstanceLocator`).
2020-02-20 09:36:34 -08:00
Abtin Keshavarzian fb65c77c1a [topology] have Neighbor/Child/Router inherit from InstanceLocatorInit (#4569)
This commit changes the `Neighbor` class (and therefore its sub-classes
`Child` and `Router`) to inherit from `InstanceLoatorInit`. It adds
`Init()` method to them as well and ensures that they are initialized
before use from `ChildTable`, `RouterTable` and `Mle` classes.
2020-02-20 09:36:34 -08:00
Abtin Keshavarzian 67c5081d14 [locator] adding InstanceLocatorInit (#4569)
This commits adds a new class `InstanceLocatorInit` which is
similar to `InstanceLoator` but provides a default constructor
(instead of a parameterized one) and allows an inheriting class to
initialize the object (set the OpenThread Instance) post constructor
call using the `Init()` method. This class is intended for types that
require a default constructor and cannot use a parameterized one. An
example of such a class is one that is used as type of a C array
element (e.g., `Neighbor`/`Child`/`Router` classes which are used as
array in `ChildTable`/`RouterTable`).
2020-02-20 09:36:34 -08:00
Jonathan Hui 0823114dff [mle] mark former parent as valid after becoming router (#4582)
Commit a8638d7 added logic to invalidate the parent upon a role
change. However, when upgrading from child to router, the existing
implementation updates the role before copying the parent into into
the router table. As a result, a router	may not	have any connectivity
with the rest of the partition until after additional MLE exchanges.

This commit marks the newly created router entry as valid so that the
router retains connectivity.
2020-02-19 22:20:01 -08:00
Yakun Xu 4d1f60d82e [build] do not export openthread/config.h (#4561)
openthread/config.h is just used when building OpenThread, and does
not contain OpenThread APIs.
2020-02-19 13:25:07 -08:00
Yakun Xu cc3e5ba6f4 [posix-host] set network interface name (#4573)
When platform netif is enabled, the TUN device's name should be able to
set from command. This PR use the existing `-I` to allow user provide a
wanted name.
2020-02-19 11:47:55 -08:00
Yakun Xu abf108a9b1 [android] build ot-ctl on Android.mk (#4567) 2020-02-19 11:46:23 -08:00
Yakun Xu 8546bceeab [build] move spinel into src/utils (#4558)
Move spinel from src/ncp into src/utils and remove dependency on
OpenThread's core configurations.
2020-02-19 11:45:35 -08:00
Yakun Xu aa62fd8f65 [cli] always output command result (#4556)
Always output command result, i.e. "Done" on success, error message
otherwise.

Factory commands also follow the same pattern. Their existing error
messages are not removed for backward compatibility consideration.
2020-02-19 11:44:42 -08:00
Simon Lin c8dff09d3a [python] remove unnecessary calls to dict.keys() (#4576) 2020-02-18 10:16:06 -08:00
Diego Ismirlian ef0cabafb1 [posix-host] explicitly ignore return value on write (#4574) 2020-02-18 10:10:52 -08:00
Yakun Xu a8638d7ff8 [mle] invalidate parent if not child (#4572)
Current Thread certification needs Parent information even after the
node already become a router or leader. This commit sets parent state
to invalid to indicate information in mParent should not be used in
normal cases.
2020-02-18 10:04:07 -08:00
Abtin Keshavarzian 9de99a8efa [toranj] fix the check for router entry "is link established" (#4566) 2020-02-18 09:53:05 -08:00
Diego Ismirlian cc115790da [efr32] remove -Wundef for SDK sources (#4565)
Restore the lines accidentally removed by commit 609665d.
2020-02-18 09:52:25 -08:00
Jonathan Hui d52f893b35 [network-data] remove redudnant code from RegisterNetworkData() (#4562) 2020-02-18 09:50:57 -08:00
Jonathan Hui 8079570ccf [network-data] resolve uninitialized output from RlocLookup (#4562) 2020-02-18 09:50:57 -08:00
Yakun Xu 1f2bed8e7d [posix-host] use c++ for all platform code (#4547)
- Switched to C++ for all drivers.
- Removed C utilities.
- Renamed sim.c to virtual_time.cpp.
- Changed platformSim prefix to virtualTime.
2020-02-13 06:15:47 -08:00
Kuznia, Rafal b4c5bd5044 [nrf528xx] add JLink subdirectory per individual chip basis (#4511) 2020-02-12 07:47:51 -08:00
Duda, Lukasz b6c534ecf0 [nrf528xx] adapt generic sdk_config.h file from nRF5 SDK (#4511) 2020-02-12 07:47:51 -08:00
Jay Logue 27128db8ee [build] support building platform code without examples (#4511)
- [build] Added --with-platform configure option to enable building
the platform libraries without building the example applications or
any supporting libraries used solely by the examples.

- [nrf528xx] Modified the nrf528xx-specific makefiles such that Nordic
SDK code located in third_party/NordicSemiconductor is only
built/referenced when building the example applications.  When
building just the platform libraries, the caller of configure is
expected to provide the correct arguments to use an external copy of
the Nordic nRF5 SDK.  An exception to this is the 802.15.4 radio
driver, which is always built using the sources in
third_party/NordicSemiconductor/drivers/radio.

- [nrf528xx] Made various minor edits to #include statements in the
nrf528xx platform code.  This was necessary because of the difference
in directory structure between the code in
third_party/NordicSemiconductor and that in the formally published
Nordic nRF5 SDK.
2020-02-12 07:47:51 -08:00
Yakun Xu a70007dbdf [build] auto detect big endian (#4551) 2020-02-12 07:42:50 -08:00
Neal Jackson 1145d32cb0 [coap] fix comparison with block size validity check (#4553) 2020-02-12 07:15:40 -08:00
Yakun Xu 954a9f284e [android] move OPENTHREAD_POSIX_RCP_UART_ENABLE (#4549)
The macro OPENTHREAD_POSIX_RCP_UART_ENABLE should be defined for all
builds, not only for CI tests.

This commit also sorts the definitions removed duplicate definitions.
2020-02-11 14:40:31 -08:00
ludu f7136eba3e [address-resolver] add log on new cache entry creation (#4540) 2020-02-11 14:18:08 -08:00
Duda, Lukasz d3bca730aa [address-resolver] introduce MoveAt functionality (#4540) 2020-02-11 14:18:08 -08:00
Duda, Lukasz c85a1c3c71 [address-resolver] dequeue message from resolving queue before invalidate the entry (#4540) 2020-02-11 14:18:08 -08:00
Duda, Lukasz 61b18cbde5 [address-resolver] fix last transaction time of entry created by packet inspection (#4540) 2020-02-11 14:18:08 -08:00
Duda, Lukasz 17f779fa62 [address-resolver] accept multicast Address Error Notification (#4540) 2020-02-11 14:18:08 -08:00
Yakun Xu 3d029d27fc [spinel] fix when strnlen is not a macro (#4548)
If strnlen is a normal function, the current code will result in
duplicate definition error.
2020-02-11 12:01:29 -08:00
Jonathan Hui 0a730cd2d0 [docs] correct dataset activetimestamp example (#4545) 2020-02-11 07:33:05 -08:00
Jonathan Hui 2c66141c17 [network-data] add check for invalid router IDs (#4544)
It is posisble for a leader to receive SVR_DATA.ntf messages
attempting to register with a router ID that is not valid on the
leader.

This commit does not allow registering network data with invalid
router IDs to avoid having stale network data that persists.
2020-02-11 07:32:43 -08:00
Neal Jackson b81813fa4e [coap] add helper functions to encode coap block options (#4513)
This small feature addition is two helper functions to encode the
Block1 and Block2 uint options described in RFC7959.
2020-02-11 07:29:05 -08:00
Jonathan Hui e83b8c77c0 [settings] allow value to have smaller than expected length (#4499)
Newer versions may add additional fields to the end of the settings
structure. However, there may be situations where an older version may
nead to read the structure.

This commit allows the stored settings value size to be smaller than
expected.
2020-02-11 07:12:51 -08:00
Jonathan Hui e9261b6842 [settings] initialize structure before reading from storage (#4499)
This commit initializes	the settings structures	before reading.	This
helps prepare for a following commit that allows reading stored	values
that are shorter than expected.

This commit also renames the Clear() methods to Init().
2020-02-11 07:12:51 -08:00
Yakun Xu a84fea58e1 [build] add DISABLE_TOOLS flag (#4543) 2020-02-10 08:38:18 -08:00
Łukasz Duda 1edde90d91 [sub-mac] fix incorrect timer configuration for energy scanning (#4538)
This fixes the implementation of Energy Scanning in case the platform
does not support it, but uses timer with microsecond resolution. This
is not the case with nRF528xx but found it during code inspection.

I've verified that after removing OT_RADIO_CAPS_ENERGY_SCAN
capability, the Energy Scan now works correctly.
2020-02-09 17:12:17 -08:00
Łukasz Duda b5b607cc1d [nrf528xx] fix synchronous GetRssi functionality (#4537)
This commit aligns otPlatRadioGetRssi implementation with the latest
changes to radio driver.

Without this change, for example, Channel Monitor and Energy Scanning
with duration of 0 (energy scan 0 command) does not work.
2020-02-09 17:11:07 -08:00
Łukasz Duda b62d42f0ef [mle] unify stopping of the advertising timer (#4539) 2020-02-09 15:17:02 -08:00
Abtin Keshavarzian 253e99ba17 [cli] use ICMPv6 Echo Request ID to match Responses (#4534)
This commit updates/enhances the CLI `ping` command. It adds the
feature to track and match the ICMPv6 echo requests and responses
using an identifier. Each `ping` command will use a new value as the
identifier. A received ICMPv6 echo response not matching the current
identifier is ignored. This commit also makes the following (smaller)
changes:
- renames the ping related member variables as `mPing{Name}`,
- defines  constants for default ping parameters,
- changes `ping` to use public OT APIs/definition (instead of core
  methods).
2020-02-09 15:13:59 -08:00
Jonathan Hui aa78b2688e [unit-test] fix implicit conversion in test_lowpan.cpp (#4533) 2020-02-07 22:51:48 -08:00
Jonathan Hui 28dd4475b7 [unit-test] fix 'va_start" undefiend behavior in test_linked_list.cpp (#4533)
Fixes passing an object of reference type to 'va_start' has undefined
behavior.
2020-02-07 22:51:48 -08:00
Jonathan Hui 647539632b [settings] encode non-volatile structs as little endian (#4527) 2020-02-07 22:51:21 -08:00
Jonathan Hui b2227703d7 [settings] declare non-volatile structures as packed (#4527) 2020-02-07 22:51:21 -08:00
Piotr Koziar c4940b3605 [nrf528xx] update nrf_security to 0.9.2 (#4529)
* Update nrf_security to 0.9.2

* Added MBEDTLS_PK_WRITE_C to nrf52840-mbedtls-config.h

* Enabled pk write in mbedtls Makefile. Added MBEDTLS_PK_WRITE_C to nrf52833 config
2020-02-07 08:31:22 -08:00
Jiacheng Guo c0313240d2 [android] build CLI and NCP libraries (#4528)
This enables other repositories to link against these libraries.
2020-02-07 08:28:52 -08:00
Abtin Keshavarzian 3d30955a3b [posix-app] add error if no RCP interface (SPI/UART) is enabled (#4510) 2020-02-07 08:27:15 -08:00
Abtin Keshavarzian 26d6e7faf0 [hdlc] add missing <string.h> include (for memmove()) (#4510) 2020-02-07 08:27:15 -08:00
Abtin Keshavarzian 95f700dd7e [toranj] move posix-app config defs into header file from build script (#4510) 2020-02-07 08:27:15 -08:00
Abtin Keshavarzian d052f36af8 [posix-app-config] add UART/SPI config macros and their default value (#4510)
This addresses undefined macro warnings when building posix-app.
2020-02-07 08:27:15 -08:00
Abtin Keshavarzian 53b711e4f4 [posix-app] add posix config header file (#4510)
This commit updates how posix-app source files include the config
header file to follow a similar policy as for core modules. All header
files and `cpp` files that do not have a corresponding `hpp` file
should include "openthread-posix-config.h" first (which itself will
include the core config header). The "cpp" files which have a related
"hpp" should include the related hpp file first. This way we ensure
all config macro definitions are correctly included in all modules.
2020-02-07 08:27:15 -08:00
Jonathan Hui 50e094865b [cmake] add additional compiler options (#4500) 2020-02-07 08:26:10 -08:00
Abtin Keshavarzian de7083094e [ip6] fix conversion of enum value to uint8_t (#4522)
This commit updates how the `otMessagePriority` enumeration variable
is updated in `otMessageSettings` structure. This addresses an issue
where the enum variable was being treated as an `uint8_t` which may
not necessarily be correct (since complier can choose any integral
type which covers all the enumerator values as the underlying storage
for an unscoped enumeration type).
2020-02-04 10:37:56 -08:00
Yakun Xu 33808ebfba [style] apply google python style guide (#4501)
This commit applies and enforces Google's python style for tests.
2020-02-04 10:27:50 -08:00
Jeff Bumgardner 8368d440dd [docs] update list of supporters (#4526) 2020-02-04 09:35:44 -08:00
Abtin Keshavarzian 3a25f3a020 [mle] simplify how parent candidate is cleared (#4525)
This commit inlines and removes `ResetParentCandidate()` method.
2020-02-03 22:14:31 -08:00
Diego Ismirlian 0d9f5cb58a [posix-host] add hardware flow control capability to hdlc interface (#4518) 2020-02-03 22:13:03 -08:00
Jeff Bumgardner f1dc2d882b [docs] move Doxygen group structure to the docs directory (#4476) 2020-02-03 09:17:40 -08:00
Abtin Keshavarzian 2f075974b5 [netif] simplify adding external unicast/multicast addresses (#4520) 2020-02-03 09:13:27 -08:00
Abtin Keshavarzian 8729bc4dac [netif] add helper methods to identify in-use netif address entries (#4520) 2020-02-03 09:13:27 -08:00
Abtin Keshavarzian c52ef80f4e [netif] fix typos in comments (#4520) 2020-02-03 09:13:27 -08:00
Abtin Keshavarzian 9be3de3b1d [netif] remove unused mNext pointer (#4520) 2020-02-03 09:13:27 -08:00
Abtin Keshavarzian 45d5afb10e [ip6-address] inline very simple methods (#4519)
This commit inlines the very simple methods (containing a single
basic operation) in `Ip6::Address` class.
2020-02-03 09:11:35 -08:00
Abtin Keshavarzian a5862a6de1 [ip6-address] remove undefined/unused method declaration (#4519) 2020-02-03 09:11:35 -08:00
Abtin Keshavarzian 0f274641f1 [ip6-address] simplify IsAnycastServiceLocator() (#4519)
This change ensures we avoid comparing values with host-swapped
constants.
2020-02-03 09:11:35 -08:00
Abtin Keshavarzian 16b6c8df89 [ip6-address] use larger data fields when checking against constants (#4519)
This commit changes methods in `Ip6::Address` class to use larger
fields (`m16` or `m32`) for comparing portions of address sequence
against constant values when possible.
2020-02-03 09:11:35 -08:00
Abtin Keshavarzian cd0ef26c02 [toranj] update test-012-multi-hop-traffic (#4516)
This commit updates tornaj `test-012-multi-hop-traffic` to make it
more robust by waiting for entire chain topology to be discovered
(router table to be fully updated) before starting message exchange.

This should help with rare failures of this test, which happen when an
address query response is received before the "next hop" for the
destination router is discovered (through Link Advertisement
exchanges) on the first router `r1`.
2020-01-29 22:28:47 -08:00
Neal Jackson 45d78d7871 [build] change macOS bootstrapped GCC to official ARM brew tap (#4514)
Change to using ARM's official toolchain tap.
2020-01-29 22:14:17 -08:00
Abtin Keshavarzian bc02c6c05c [mac-frame] add missing OT_TOOL_PACKED_BEGIN to Beacon class (#4509) 2020-01-27 22:21:36 -08:00
Diego Ismirlian 83c75333ec [efr32] Radio: correct PA supply selection for BRD4166A (#4506) 2020-01-27 22:21:12 -08:00
garyButt 609665d017 [efr32] add support for EFR32MG13 (#4488) 2020-01-27 22:19:17 -08:00
Abtin Keshavarzian a5f2a41cb3 [mac] simplify scan handlers (#4503)
This commit changes the energy and active scan callback handlers in
`Mac` class to make them follow the model used by external OpenThread
scan APIs. This in turn simplifies their use, allowing us to remove
the code that saved energy/active scan callbacks and contexts in the
`Instance` object. This commit also adds some missing `const` methods
to Beacon class which allows us to declare the received beacon frame
(from scan operation) as a `const`.
2020-01-23 19:48:02 -08:00
Yakun Xu 8d22fdd09c [toranj] improve code coverage by using absolute path (#4491)
Gcov sometimes cannot correctly find source files when the code is
configured with relative path. This commit enables using absolute path
to run toranj tests.
2020-01-23 19:45:51 -08:00
Jonathan Hui b0a89c4083 [nlbuild-autotools] update to 1.6.16 (#4507)
Allow absolute paths in PRETTY_FILES.
2020-01-23 19:44:18 -08:00
Jonathan Hui 69723afcb1 [mbedtls] update to 'https://github.com/nestlabs/nlbuild-autotools.git' tag '1.6.16'. 2020-01-23 19:48:38 +00:00
Jonathan Hui ba22751658 Squashed 'third_party/nlbuild-autotools/repo/' changes from b1b93c9d..4cbe14a4
4cbe14a4 Update version to 1.6.16.
7adbffbc Merge pull request #30 from bukepo/pretty/support-abs
2ac7f5da Add absolute path support for pretty

git-subtree-dir: third_party/nlbuild-autotools/repo
git-subtree-split: 4cbe14a4adb8702d81a63fd663bf046407908def
2020-01-23 19:48:38 +00:00
Yakun Xu e2800ed10d [posix-host] add otPlatRadioGetState() (#4504)
This commit implements otPlatRadioGetState() on POSIX platforms,
including simulation and posix-host app.

This is for debugging purpose.
2020-01-23 10:45:15 -08:00
Yakun Xu e5d4b971fe [nrf528xx] support pretty out of source directory (#4505)
This commit enhances the Makefile.am of nrf528xx to support make
pretty out of the source directory.
2020-01-23 10:21:30 -08:00
Simon Lin ff5b209fe4 [build] fix wrong macro name (#4498) 2020-01-23 10:18:33 -08:00
Yakun Xu 0e051b1a27 [cli] emit SIGINT on ctrl-c (#4502)
This commit emits SIGINT on ctrl-c so that gdb can work as expected.
2020-01-23 08:42:22 -08:00
amosolgo-lutron 1f9118834a [mbedtls] split builtin mbedtls management option from mbedtls build option (#4473)
Add a new OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT flag to
configure builtin mbedtls buffer/debug management separately from the
existing flag which configures the inclusion of the builtin mbedtls
library in the build.
2020-01-23 08:41:07 -08:00
Abtin Keshavarzian a5369eaa98 [address-resolver] rename static method to InvalidationReasonToString (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 24b84cc762 [mle] rename static methods converting between service ALOC and Id (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian c9ce2d42e9 [mle] rename static method to ChildIdFromRloc16() from GetChildId() (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian b7a56cdfd7 [mesh-forwarder] use Mle::RouterIdMatch() helper method (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian e2403f6066 [mle] rename static method to RouterIdFromRloc16() from GetRouterId() (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 05747e7670 [mle] rename static method to Rloc16FromRouterId() from GetRloc16() (#4486)
This commit renames the static `Mle` method which derives RLOC16
from a given Router ID to `Rloc16FromRouterId()` from `GetRloc16()`.
This helps distinguish this method from other `GetRloc16()` methods.
2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 5ba6ede53a [mle-router] use routerId as variable name (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 515e3bde8c [mle] update route table log message (#4486)
This commit updates the route table log message to include if link
is established with router or not (router is a neighbor). Also the
`0xffff` is printed as next hop if it is invalid and we indicate
if the entry is for the device itself.
2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 583873c133 [mle] log rloc16 changes (#4486) 2020-01-22 20:52:09 -08:00
Diego Ismirlian f816635465 [efr32] Radio: use RAIL_CopyRxPacket (#4484) 2020-01-22 14:53:14 -08:00
Diego Ismirlian 59b3c51184 [efr32] Radio: correctly set mAckedWithFramePending (#4484) 2020-01-22 14:53:14 -08:00
Jonathan Hui f6738b78e9 [configure] remove _BSD_SOURCE _DEFAULT_SOURCE (#4483) 2020-01-22 13:39:25 -08:00
Jonathan Hui 5b22b4d7c7 [utils] remove wrap_string.h (#4483) 2020-01-22 13:39:25 -08:00
Jonathan Hui 71a7e47c81 [utils] remove strnlen (#4483) 2020-01-22 13:39:25 -08:00
Jonathan Hui 708c250fe5 [utils] remove strlcpy (#4483) 2020-01-22 13:39:25 -08:00
Jonathan Hui 5c9b60b855 [utils] remove strlcat (#4483) 2020-01-22 13:39:25 -08:00
Yakun Xu 26694bee5c [ncp] simplify unimplemented commands (#4490) 2020-01-22 10:18:54 -08:00
kangping 51bb4be6c4 [meshcop] fix premature free of finalize message (#4487)
This commit fixes a bug that the finalize message will be prematurely
freed if the joiner is started at the second time without waiting for
the finish of the first initiation.
2020-01-22 10:05:22 -08:00
Zhanglong Xia f0c063f8e9 [posix-host] add SPI interface support (#4431) 2020-01-21 19:24:42 -08:00
Rongli Sun ef4530a187 [commissioner] remove duplicate CoapSecure::Stop() call (#4495) 2020-01-21 14:18:47 -08:00
Yakun Xu 59b49de355 [codecov] ignore third_party code (#4489) 2020-01-21 14:08:48 -08:00
Jiacheng Guo 59fc287024 [travis] correct error message output (#4477) 2020-01-21 13:59:46 -08:00
Diego Ismirlian c4f32fd907 [efr32] Radio: Use assert to detect issues when interacting with RAIL (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian f947eefa51 [efr32] Radio: honor mMaxCsmaBackoffs and implement get/set CcaEnergyDetectThreshold (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian 0c48c06061 [efr32] Radio: implement Rx timestamping (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian 312dad2578 [efr32] Radio: handle promiscuous mode for ACK packets (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian 002f9dbe38 [efr32] Radio: signal event pending when failed to start tx (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian 0ef278af6b [efr32] Radio: change core configurations (#4482)
- Set OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE=0 and
  OPENTHREAD_CONFIG_SOFTWARE_ENERGY_SCAN_ENABLE=0 according to the implemented
  hardware capabilities.

- Undefine RADIO_CONFIG_SRC_MATCH_*_ENTRY_NUM to let the soft source match table
  implementation define them as OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
2020-01-17 10:59:34 -08:00
Diego Ismirlian 46b7d09f14 [efr32] Radio: remove duplicate calls (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian c47bded0ae [efr32] Radio: correct macAckWaitDuration (#4482) 2020-01-17 10:59:34 -08:00
Diego Ismirlian 9b86de8260 [posix-host] explicitly ignore return value on write (#4480)
Build failed because write was declared with attribute warn_unused_result.
2020-01-17 08:24:47 -08:00
Jonathan Hui 73ff9439e6 [ncp] remove dead code in SPINEL_PROP_STREAM_NET set handler (#4475) 2020-01-14 22:10:38 -08:00
Jiacheng Guo 7d92134da2 [posix-host] add command mode for ot-ctl (#4457)
ot-ctl will now send the command line arguments to ot-daemon and print
the reply.
2020-01-14 22:07:36 -08:00
kangping 05ba4c29f4 [script] add ppa without user input (#4474) 2020-01-14 12:58:25 -08:00
konradderda 1ab8661d80 [ncp] add timestamp to log metadata fields (#4439)
This change adds an information about the timestamp to the log
metadata that is calculated with the formula: <timestamp_base> +
<time_from_start_in_ms>. The <timestamp_base> value is set to 0 by
default and can be changed with a new SPINEL property:
SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE formatted as X (uint64_t).
2020-01-14 12:57:35 -08:00
Diego Ismirlian 51485d4ecd [mac] correct default OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT (#4432) 2020-01-13 15:24:48 -08:00
Abtin Keshavarzian 78156bbdcd [unit-test] add unit test for Mesh/Fragment Header (#4453) 2020-01-13 10:57:42 -08:00
Abtin Keshavarzian b99f434a88 [lowpan] update BufferWriter to use end pointer instead of length (#4453)
This commit also updates some of `Lowpan` (decompression) methods to
use an end pointer instead of tracking remaining length.
2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 17168e9ba1 [lowpan] simplify FragmentHeader and its use in MeshForwarder (#4453)
This commit updates the `Lowpan::FragmentHeader` class to provide
methods to parse/write the Fragment Header from/to a given frame or
message.
2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 2ec0d2f8d4 [mesh-forwarder] skip mesh header immediately after parsing it (#4453)
This commit updates `HandleMesh()` method to skip the mesh header in
the frame immediately after parsing it. This in turn removes the need
for other methods (`CheckReachability` or `UpdateRoutes()` calling
through `GetIp6Header()` to `DecompressIp6Header()`) to redo the
parsing to skip the mesh header. With this change we can also remove
the now unused `SkipMeshHeader()`.
2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 086753c08d [lowpan] simplify MeshHeader and its use in MeshForwarder (#4453)
This commit updates the `Lowpan::MeshHeader` class to provide methods
to parse/write the Mesh Header from/to a given frame or message. The
`MeshHeader` no longer provides a direct representation of the header
(instead, it contains all fields required to generate the header).
This is mainly due to fact the header format itself may vary depending
on the "hops left" value. This change also removes the need for the
`MeshHeader` to be a packed `OT_TOOL_PACKED` structure.
2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 85ddb11add [mesh-forwarder] use pointer to iterate through mFragmentEntries (#4453) 2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 5eba7f1cb4 [mesh-forwarder] simplify GetForwardFramePriority() and remove GetMeshHeader() (#4453)
Before passing the frame to `GetForwardFramePriority()` the mesh
header is skipped (to avoid re-reading the mesh header). Also the
src/dest parameters are renamed to indicate they are mesh source and
mesh destination (also the order of parameters changed to start with
source and then dest). With this change we can remove
`GetMeshHeader()` (since no longer used/needed).
2020-01-13 10:57:42 -08:00
Abtin Keshavarzian 1a96fef16d [mesh-forwarder] use SuccessOrExit, update comments (#4453) 2020-01-13 10:57:42 -08:00
Jonathan Hui 40a84bb18f [cli] add mSntpQueryingInProgress to initializer list (#4464) 2020-01-13 06:44:34 -08:00
Jonathan Hui fd808f72c1 [mac] add mPromiscuous to initializer list (#4464) 2020-01-13 06:44:34 -08:00
Jonathan Hui 1801e6c601 [dataset] add mSaved to initializer list (#4464) 2020-01-13 06:44:34 -08:00
Abtin Keshavarzian bfa82fbb3b [build] define OPENTHREAD_FTD/MTD/RADIO in posix-app and unit test makefiles (#4469)
This helps address undefined config macro warnings.
2020-01-12 22:15:24 -08:00
Marven Gilhespie 4695b74771 [efr32] remove SDKVERSION in makefiles to fix SDK v2.7 build (#4466) 2020-01-12 22:13:06 -08:00
Jonathan Hui 1a5c687810 [mle] remove redundant call to RouterTable::GetRouter (#4465) 2020-01-12 22:09:22 -08:00
Jonathan Hui 4b0822fa8e [ncp] remove dead code in SPINEL_PROP_STREAM_NET_INSECURE set handler (#4463) 2020-01-12 22:09:01 -08:00
Jonathan Hui 3ea4c91b75 [nlbuild-autotools] update to 1.6.15 (#4468) 2020-01-12 22:08:16 -08:00
Robert Szewczyk 0dbae78d4c [nlbuild-autotools] update to 'https://github.com:nestlabs/nlbuild-autotools' tag '1.6.15'. 2020-01-10 17:09:06 -08:00
Robert Szewczyk 8e95e5e34c Squashed 'third_party/nlbuild-autotools/repo/' changes from 6b6a11dc9..b1b93c9de
b1b93c9de Merge pull request #29 from robszewczyk/bug/redundant-libtool-libraries
92cda4133 Remove inconsistent libtool libraries and automake-distributed files
9e610e1e0 Merge pull request #27 from nestlabs/feature/github-issue-26
17b0d3033 Attempt to use HTTP rather than FTP to address random Travis CI fetch failures.
83c3fbd6e Ensure that package retrievals have at least four (4) retries.
330ea5628 Update the manifest to ensure 'make dist' works.
10c35016c Add a Travis CI build status badge.
8e08dc7e6 Initial revision.
e05a00c3b Merge pull request #25 from robszewczyk/bug/update-coreutils
e0c75cf3e Update coreutils s.t. the tools can be built on newer Linux systems
4db93dd94 Merge pull request #24 from robszewczyk/feature/header-depend-on-built-sources
244f42204 Bookkeeping: default version and changelogs
6dd233313 install-headers target should depend on BUILT_SOURCES
650b05690 Merge pull request #23 from nestlabs/bug/address-bootstrap-bashism

git-subtree-dir: third_party/nlbuild-autotools/repo
git-subtree-split: b1b93c9de7121dcd6099fb3b651b8a6ed5b42d22
2020-01-10 17:06:37 -08:00
Stuart Longland 033cf4c4b1 [coap] add otCoapOptionIterator and related API functions (#4452)
This commit adds a otCoapOptionIterator structure which the user can
use to iterate over the CoAP options of a ot::Coap::Message object
without influencing any of the properties of that object.

Multiple otCoapOptionIterator structures may operate on the same
ot::Coap::Message object without interference.
2020-01-10 08:46:53 -08:00
周瑞祺 bfa84c26b0 [harness-sniffer] add OT sniffer support in Thread Test Harness (#4233)
Run Test Harness with OT sniffer.
2020-01-10 08:43:37 -08:00
Jintao Lin 8788cf5a97 [posix-host] add posix parameter to get dataset from NCP and save to file (#4446)
There are cases when NCP platform was used at first. Then need to
change to use RCP platform later. The PAN active and pending dataset
needs to be retrieved from NCP firmware to avoid repairing again.

This change,
1. Add one parameter to posix host (--ncp-dataset).
2. Avoid some radio spinel command and check so that posix app can start
otInstance and talk to NCP firmware.
3. Utilize spinel property SPINEL_PROP_THREAD_ACTIVE_DATASET and
SPINEL_PROP_THREAD_PENDING_DATASET to retrieve dataset from NCP.
2020-01-09 18:15:23 -08:00
Jonathan Hui f520ea9a76 [announce-sender] fix bug in computing announce period (#4460) 2020-01-09 14:02:11 -08:00
Jonathan Hui c46c9f4374 [examples-posix] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Abtin Keshavarzian 4b6ba537df [ncp] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Abtin Keshavarzian b853231920 [posix-app] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Abtin Keshavarzian cf809bd16a [ncp/cli/posix-app] disable coverage test when macro not defined (#4458)
This change help suppress the undefined macro warnings.
2020-01-09 11:45:39 -08:00
Abtin Keshavarzian da6c00bd29 [utils-settings] add a header file for settings config definitions (#4458)
This commit adds a header file `settings.h` to include all the
default configuration definitions related to `settings` platform
utility. It also adds `OPENTHREAD_SETTINGS_RAM` to this file.
This helps address the undefined macro warnings.
2020-01-09 11:45:39 -08:00
Abtin Keshavarzian 812e108103 [example-posix] add missing config definitions (#4458)
This commit updates `platform-config.h` to add default value for
config definitions. This helps suppress the undefined macro
warnings.
2020-01-09 11:45:39 -08:00
Abtin Keshavarzian 3cb411ca22 [toranj] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Abtin Keshavarzian ebc8684307 [wrap-strings] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Abtin Keshavarzian 0215527358 [spi-hdlc-adapter] fix undefined config macro warnings (#4458) 2020-01-09 11:45:39 -08:00
Marven Gilhespie 73e30d1d7b [efr32] update to Silicon Labs SDK v2.7 (#4447)
Updated makefiles for v2.7 SDK
Replaced RAIL timers with sleeptimers.
2020-01-08 10:14:12 -08:00
Abtin Keshavarzian b87545f0c8 [mesh-forwarder] fix incorrect cast to uint8_t when setting frame length (#4456) 2020-01-08 08:41:59 -08:00
Rongli Sun f976db5c4c [mle] link sync enhancement (#4427)
There is chance for below scenario:
1) Device newly becomes router and sends multicast Link Request
   (challenge1),
2) Device receives MLE advertisement from one neighbor, and sends
   unicast Link Request (challenge2),
3) The neighbor ignores the unicast link Request in 2) and sends
   out Link Accept and Request message as response for 1)
4) Device would drop the Link Accept adn Request message
   in 3) as it compares the Response TLV value with challenge2, which
   in fact matches challenge1.

The link between Device and the neighbor could not be established until
Device receives next MLE advertisement from the neighbor.

This commit suppresses unicast Link Request in 2) if there is multicast
Link Request ongoing. Thus the three-handshakes link sync could go well.
2020-01-08 08:39:10 -08:00
Diego Ismirlian e44461151f [build] detect undefined macros to avoid misconfigurations (#4300) 2020-01-08 08:37:46 -08:00
Diego Ismirlian 4fec70b67d [network-data] fix compile error when building service without border router (#4443) 2020-01-07 12:48:33 -08:00
konradderda 77ae260c77 [mle] allow setting router eligible attr to false for MTD (#4450) 2020-01-06 10:45:28 -08:00
Łukasz Duda aa9a45d212 [nrf528xx] return the TX power which was actually set in the register (#4451)
This commit ensures that TX Power returned via
otPlatRadioGetTransmitPower is one that is actually set in the
register. E.g. even if TX power is set to 100 via
otPlatRadioSetTransmitPower, the maximum power is 8 for nRF52840.
2020-01-06 10:05:09 -08:00
Abtin Keshavarzian 568fab148b [ncp-base] use macros to simplify the handler arrays definitions (#4448) 2020-01-06 08:32:06 -08:00
Abtin Keshavarzian 597e112259 [ncp-base] use array and binary search for insert/remove prop handlers (#4448) 2020-01-06 08:32:06 -08:00
Abtin Keshavarzian d7e9e5db31 [ip6] fix the fragmentation header check (#4445) 2020-01-06 08:28:50 -08:00
Yakun Xu 809e7e641c [tlv] add AppendTo to resolve mutual dependency (#4438)
This commit adds AppendTo(Message) to Tlv, so that Message doesn't
depend on Tlv any more. This allows a concrete Tlv overriding its
serialization.
2020-01-06 08:23:15 -08:00
Diego Ismirlian 53e4bcbfee [platform/utils] RTT: remove non-functional config of Up Buffer's size (#4436)
And document how to configure it if needed.
2020-01-06 08:19:22 -08:00
Jiacheng Guo 90eda6ef6b [mle] fix build error caused by GetParent return type change (#4437)
The GetParent return type was updated in 1996d42.
2020-01-06 08:16:58 -08:00
Jonathan Hui 5b0af03afb [dataset] check if dataset is present in otDatasetIsCommissioned (#4426)
otDatasetIsCommissioned API first reads out the Active Dataset from
settings (i.e. non-volatile storage). However, the existing
implementation does not check if the Active Dataset is actually
present, as indicated by OT_ERROR_NOT_FOUND.

This commit adds a necessary check and returns false if the Active
Dataset is not present.
2019-12-23 10:25:39 -08:00
Jonathan Hui 4fe0e718d5 [network-data] support registration on child devices (#4425)
A device's request to register network data information is triggered
by a call to NetworkData::Local::SendServerDataNotification().
However, the call was only made by devices operating in the router
or leader roles.

This commit moves the call so that network data registration is
triggered in the child role, in addition to the router and leader
roles.
2019-12-23 09:54:59 -08:00
Abtin Keshavarzian 9398c591bf [child-table] move StateFilter definition to Neighbor (#4419) 2019-12-19 13:27:15 -08:00
Abtin Keshavarzian 5fd1083d14 [topology] move IsStateValidOrAttaching to Neighbor (#4419) 2019-12-19 13:27:15 -08:00
Abtin Keshavarzian 636352431f [data-poll-sender] add GetParent() (#4419)
This commit changes the `Mle::GetParentCandidate()` to return a
reference to the parent candidate and moves the selection logic
between parent or parent candidate when sending data polls to
`DataPollSender` from the newly added `GetParent()` method.
2019-12-19 13:27:15 -08:00
Abtin Keshavarzian 1996d42d9d [mle] update Mle::GetParent() to return reference (#4419) 2019-12-19 13:27:15 -08:00
Abtin Keshavarzian bf4c7370bf [mle] add Mle::IsAttaching() method (#4419) 2019-12-19 13:27:15 -08:00
Paweł Wańczyk 194ea70abb [mac] add retry flag support for direct messages (#4421) 2019-12-19 11:17:41 -08:00
Li Cao aec3e66e54 [network-diagnostic] remove useless include (#4422) 2019-12-19 09:55:39 -08:00
Jonathan Hui c740a053fd [travis] add build check with all features enabled (#4418) 2019-12-18 15:43:44 -08:00
Jonathan Hui 2f18984017 [ncp] only support MLE_STEERING_DATA_SET_OOB_ENABLE in FTD (#4418) 2019-12-18 15:43:44 -08:00
Jonathan Hui 7695a2e0e4 [config] rename INITIAL_LOG_LEVEL to LOG_LEVEL_INIT (#4418) 2019-12-18 15:43:44 -08:00
Jonathan Hui 37d136d0fb [config] rename ENABLE_DYNAMIC_LOG_LEVEL to LOG_LEVEL_DYNAMIC_ENABLE (#4418) 2019-12-18 15:43:44 -08:00
Jonathan Hui 2beb6778b7 [config] remove duplicate definitions (#4418)
- OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
- OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
2019-12-18 15:43:44 -08:00
Jonathan Hui 2a9f1c76d1 [link-quality] remove ENABLE_TX_ERROR_RATE_TRACKING feature flag (#4417)
OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING defaults to 1 and
there have not been any	known users setting the	feature flag to 0.
2019-12-18 10:24:13 -08:00
Paweł Wańczyk c646e6f57a [mac] TxRetry histogram and maximal TxRetry expiry counter added (#4382) 2019-12-18 10:23:43 -08:00
Zhanglong Xia ed34a53829 [posix-host] add spinel_interface to extend transport layers (#4385)
This commit abstracts the API between radio_spinel and hdlc_interface
into a common interface spinel_interface. Users can use this interface
to add new transport layers to send/receive spinel frames.
2019-12-17 22:44:14 -08:00
Yakun Xu 2327072563 [ncp] conform with c++11 constexpr and static_assert (#4416)
C++11 constexpr doesn't support local variables and loop. This commit
uses recursive way to assert handlers are sorted.

C++11 static_assert requires a message. This commit adds the missing
messages to static_assert calls.
2019-12-17 22:42:35 -08:00
kangping 420479d899 [script] fix linking clang-format-6.0 on Mac OS X (#4414) 2019-12-17 08:52:26 -08:00
Jing Ma e79bb5557e [thci] add configurable device connection type for OpenThread_WpanCtl (#4364) 2019-12-16 21:00:12 -08:00
Simon Lin b4f245b025 [logging] reduce otThreadErrorToString code size (#4412)
This commit reduces the code size of otThreadErrorToString by about
900 bytes.
2019-12-16 20:56:59 -08:00
Yakun Xu 47b4192503 [ncp] reduce size by searching property handlers (#4409)
The big `switch` generates a lot of code on some compilers. This
commit drops the switch way to find getters and setters, instead a
binary search is used to find property handlers. This requires all
handlers are defined in a sorted array.
2019-12-16 20:55:40 -08:00
Yakun Xu a9a7599130 [spinel] add missing name for radio caps (#4410) 2019-12-16 12:37:04 -08:00
Yakun Xu a1f7e43452 [posix-host] set logging level early (#4408)
This commit sets logging level just after parsing command line
arguments so that dying messages during initialization can be printed.
2019-12-16 12:35:55 -08:00
Jonathan Hui c3a3a0c424 [commissioner] use strnlen instead of strlen (#4404) 2019-12-16 09:04:09 -08:00
Jonathan Hui b8c3161281 [commissioner] add network name length check in GeneratePskc() (#4404) 2019-12-16 09:04:09 -08:00
Abtin Keshavarzian e8735f45f2 [spinel] remove unused type definition (spinel_cit_t) (#4402) 2019-12-16 09:03:48 -08:00
Abtin Keshavarzian b689510672 [spinel] relax spinel_mcu_power_state_to_cstr input to allow any uint8_t (#4402) 2019-12-16 09:03:48 -08:00
Abtin Keshavarzian bae83ddfbc [spinel] add spinel_command_t & spinel_capability_t types as uint32_t (#4402) 2019-12-16 09:03:48 -08:00
Abtin Keshavarzian 943715c464 [spinel] define spinel_prop_key_t and spinel_status_t as uint32_t (#4402)
This commit defines `spinel_prop_key_t` and `spinel_status_t` as
`uint32_t` instead of `enum` value. This allows these types to
take values not included in `enum` (e.g., vendor or experimental
values) and addresses "out-of-range enumeration value" compiler
warnings.
2019-12-16 09:03:48 -08:00
Jonathan Hui f0a753c0a9 [ip6] replace IpProto type with uint8_t (#4403)
To avoid operating on unspecified values.
2019-12-13 17:21:01 -08:00
Jonathan Hui 04bec267e4 [network-diagnostic] avoid reference binding to null pointer (#4401) 2019-12-13 17:20:31 -08:00
Jonathan Hui f49d8b7b1d [mle] set appropriate Response TLV length in SendChildUpdateResponse (#4400) 2019-12-13 17:20:01 -08:00
Jonathan Hui dff1694fe1 [dns-client] add const to address pointer (#4399)
- Also change CLI implementation to avoid reference binding to null pointer.
2019-12-13 17:19:34 -08:00
Jonathan Hui 1ea4ed3eab [mle] add error logs to message handlers (#4398) 2019-12-13 17:18:16 -08:00
Jonathan Hui 36aebfae2a [logging] remove otLogInfoCoapErr (#4398) 2019-12-13 17:18:16 -08:00
Jonathan Hui 88b2fa6fbb [logging] remove otLogWarnMleErr (#4398) 2019-12-13 17:18:16 -08:00
Jonathan Hui 235d440e5d [logging] remove unused otLog*Err macros (#4398) 2019-12-13 17:18:16 -08:00
Zhanglong Xia 57b0f533bb [posix-host] update the function IsSafeToHandleNow() to avoid re-entrant issue (#4407)
mWaitingKey != SPINEL_PROP_LAST_STATUS means the NCP is waiting for a
spinel response from RCP. When mWaitingKey is set to
SPINEL_PROP_LAST_STATUS and HdlcInterface receives a ChildIdResponse
message from RCP,HdlcInterface calls the function Decode() to decode
the received HDLC frame. Then the decoded spinel frame is sent to
RadioSpinel module. Because the function IsSafeToHandleNow() returns
true now, the RadioSpinel sends the received ChildIdResponse frame to
up layer immediately. Then the MLE layer calls the function
otPlatRadioSetShortAddress() to set short address. The function
otPlatRadioSetShortAddress() sends spinel frame MAC_15_4_SADDR to RCP
and waits for the spinel response. When the response frame is
received, the HdlcInterface calls the function Decode() again, the
function Decode() uses previous calculated FCS value to calculate the
current received HDLC frame. The wrong FCS value caused the parsing
error for the received response frame.
2019-12-13 12:05:52 -08:00
Abtin Keshavarzian ef7a230c31 [travis] check vendor ncp hook example build under posix (#4405) 2019-12-13 09:14:51 -08:00
Abtin Keshavarzian 71dc756286 [ncp-vendor-hook] update example to show how to subclass (#4405) 2019-12-13 09:14:51 -08:00
Abtin Keshavarzian 36ad76e53d [ncp-vendor-hook] fix example code to use new NcpBase method (#4405) 2019-12-13 09:14:51 -08:00
Łukasz Duda 295ce1125e [diag] add radio state command (#4394) 2019-12-13 08:53:46 -08:00
Zhanglong Xia 7f61a9ee15 [posix-host] parse all parameters to a structure (#4386)
This commit parses all parameters to a structure and puts all
parameters parsing code in the function ParseArg(). It makes us easier
to add new parameters to posix host.
2019-12-13 08:47:45 -08:00
Abtin Keshavarzian ab89f40385 [unit-test] add test covering netif multicast address methods (#4388) 2019-12-12 08:56:08 -08:00
Abtin Keshavarzian 9c69030ae4 [netif] allow addition of external multicast addresses in any state (#4388)
This commit updates the Netif's handling of multicast addresses to
allow user to subscribe to (or unsubscribe from) an external multicast
address in any state. This aligns the behavior of external multicast
addresses with how external unicast addresses are handled (user can
already add/remove unicast addresses in any state).

This commit also adds checks to ensure user cannot subscribe to fixed
multicast addresses (e.g., link-local all nodes, realm-local all
routers, etc.) using `SubscribeExternalMulticast()`.

This commit also updates the implementation of methods dealing with
fixed multicast addresses to use the newly added `LinkedList` methods.
2019-12-12 08:56:08 -08:00
Abtin Keshavarzian 802c9dfcbc [linked-list] add Find() and GetTail() methods (#4388)
The `LinkedList::Find()` method searches for a given entry in the
linked list and if found returns a pointer to the previous entry
behind it. The `LinkedList::GetTail()` returns the tail of the list
(last entry in the list). This commit also updates the unit test
`test_linked_list` to verify the behavior of newly added methods.
2019-12-12 08:56:08 -08:00
Abtin Keshavarzian db1f7d2eac [toranj] add cmake option to build script (#4374)
This commit adds a `cmake` option to the `build.sh` to configure and
build OpenThread NCP/CLI for FTD/MTD/RCP modes using cmake/ninja.
2019-12-11 09:26:32 -08:00
Abtin Keshavarzian c75533fd15 [cmake] add OT_CONFIG to specify project core config header file (#4374)
This commit adds new parameter `OT_CONFIG` to main `CMakeLists.txt`
file. This parameter allows users to specify a project-specific core
config header file (mapped to `OPENTHREAD_PROJECT_CORE_CONFIG_FILE`)
during build configuration.

The default value for this parameter is "none". When not specified
(value is "none"), a platform cmake file may choose to change
`OT_COFNIG` variable to provide its own core config header file. This
commit updates platform 'posix' and 'cc2548' cmake files to provide
platform specific header files when `OT_CONFIG` is not specified by
user.
2019-12-11 09:26:32 -08:00
Abtin Keshavarzian 6c159e7de2 [code-utils] update comments (#4367) 2019-12-11 09:16:48 -08:00
Abtin Keshavarzian cd1804fa38 [unit-test] allow project to specify platform log config in unit tests (#4367)
This commit removes the hard-coded `OPENTHREAD_CONFIG_LOG_PLATFORM=0`
configuration in the unit test makefile. This allows the project build
to specify whether the platform logging should be enabled in unit
tests or not (and removes the complier warning for possible re-definition
of this configuration option).
2019-12-11 09:16:48 -08:00
Abtin Keshavarzian eaf2e7b9f7 [unit-test] add a common function to dump buffer content (#4367)
This commit updates `test_utils.hpp/cpp` to include a common helper
function `DumpBuffer` to print the content of a buffer (as hex and char string)
to screen. It also removes unused helper functions and use of STL header
files and types.
2019-12-11 09:16:48 -08:00
Abtin Keshavarzian 91e8903699 [unit-test] use OT_STATIC_ASSERT in unit tests (#4367)
This commit removes `CompileTimeAssert` (which was an empty macro).
 Instead `OT_STATIC_ASSERT` is used in `test_toolchain.cpp`.
2019-12-11 09:16:48 -08:00
Abtin Keshavarzian 5be9084add [unit-test] remove Log() from test_utils.h (#4367) 2019-12-11 09:16:48 -08:00
Abtin Keshavarzian f10c6c36fd [unit-test] remove (unnecessary) ENABLE_TEST_MAIN definition (#4367) 2019-12-11 09:16:48 -08:00
Abtin Keshavarzian ab27fcd9e6 [unit-test] remove extra \n at end of error message (#4367)
This commit removes the extra `\n` at the end of error message strings
used in `VerifyOrQuit()` or `SuccessOrQuit()` macros in different unit
test modules. This help make the style (usage of macros) consistent
across all unit tests.
2019-12-11 09:16:48 -08:00
Abtin Keshavarzian 720e9130da [unit-test] update test_util SuccessOrQuit/VerifyOrQuit macros (#4367) 2019-12-11 09:16:48 -08:00
Jing Ma 554407d107 [harness-automation] support RF-shield test cases (#4231)
- RF-shield needed cases 6.3.2, 5.6.7, 9.2.9, 9.2.10 automation both
  on CV and IV testbed

- Added DUT2_DEVICE and SHIELD_GOLDEN_DEVICES in settings file which
  list the second DUT and golden devices in RF-box. The emulation of
  the required shielding/unshielding test environment is achieved by
  controlling the programmable RF-switch (example: Agilent 3499B + HP
  44476A microwave switch module) via scripts (configure
  SHIELD_CONTROLLER_TYPE and SHIELD_CONTROLLER_PARAMS in settings
  file) and final impacting the IN/OUT signal of the devices in the
  box.

- Added case_need_shield and device_order parameters in RF-shield
  needed case scripts for checking if test case needs to use RF-shield
  box and its device order on the Test Harness Testbed page.
2019-12-11 09:14:37 -08:00
Łukasz Duda 8a1992e2e4 [nrf52833] fix bootloader configuration (#4392) 2019-12-10 10:19:05 -08:00
Kamil Sroka 1d5497ef7f [nrf528xx] fix void * dereference (#4391) 2019-12-10 10:16:55 -08:00
Duda, Lukasz 232b73477a [nrf528xx] align SDK components to version 16.0 (#4390) 2019-12-10 10:16:46 -08:00
Duda, Lukasz a08a9ceee3 [nrf528xx] update nRF IEEE 802.15.4 Radio Driver to version 1.6.1 (#4390) 2019-12-10 10:16:33 -08:00
Abtin Keshavarzian a52d80e475 [mac] update/clean-up comments (#4384) 2019-12-10 09:03:57 -08:00
Abtin Keshavarzian ca16be06d5 [mac] simplify handling of Mac::Filter and fixed RSS (#4384) 2019-12-10 09:03:57 -08:00
Abtin Keshavarzian e67fd2c0bd [mac] use VerifyOrExit for simpler checks (#4384) 2019-12-10 09:03:57 -08:00
Abtin Keshavarzian 64f29fb29e [mac] simplify ProcessReceiveSecurity (#4384)
This method simplifies `Mac::ProcessReceiveSecurity()` method, by
initializing `error` as `OT_ERROR_SECURITY` and only setting it to
`OT_ERROR_NONE` after all checks are passed (allowing checks to use
`VerifyOrExit()` without updating of `error` variable).
2019-12-10 09:03:57 -08:00
Simon Lin 6275173bab [thci] fix wrong call to .lstrip('0x') (#4383)
Wpanctl THCI might return the wrong RLOC address when RLOC16 == 0 due
to incorrect call to .lstrip('0x').  We use .lstrip('0x') to strip
'0x' at the beginning of a hex string, however this is not correct
when the hex string is '0x0', because '0x0'.lstrip('0x') == ''

This commit fixes all incorrect calls to .lstrip('0x'). There are 3
different kinds of fix:

- s.lstrip('0x') replaced by self.__lstrip0x(s) (lstrip_0x is a
  correct implementation of stripping '0x' at the beginning of a
  string)

- hex(v).rstrip('L').lstrip('0x') replaced by '%x' % v

- hex(v).lstrip('0x').zfill(4) replaced by '%04x' % v
2019-12-10 08:56:52 -08:00
Rongli Sun eb2c2dfb26 [cli] extend ping to allow hoplimit configuration (#4370) 2019-12-10 08:51:26 -08:00
Rongli Sun b77c244290 [ip6] allow hoplimit 0 (#4370) 2019-12-10 08:51:26 -08:00
Piotr Szkotak 3244d7a644 [nrf528xx] change used FEM implementation from simple_gpio to three_pin_gpio (#4387) 2019-12-06 10:46:58 -08:00
Yakun Xu f7555a54f3 [posix-host] add cmake support (#4379) 2019-12-06 09:03:17 -08:00
Rongli Sun b4b0531433 [tests] replace get_addr_rloc() by get_rloc() (#4380) 2019-12-06 08:51:23 -08:00
Rongli Sun 76f847babc [tests] add ipv6 source selection test (#4380) 2019-12-06 08:51:23 -08:00
Abtin Keshavarzian bf4dae0c18 [settings] add Clear() method for all setting structures (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian b5846532fe [mac] use Mac::ResetCounters() (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 8297dd6634 [factory-diags] add Diags::Stats::Clear() method (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 4a9d80cef1 [coap-message] add HelpData::Clear() method (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 663b59eb57 [socket] add SockAddr::Clear() (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 57f5044c9a [key-manager] add Pskc::Clear() method (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 56d3a469b2 [mac-types] add Mac::ExtendedPanId::Clear() method (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 52a04dbed1 [mac-types] add Clear() and Fill() method to Mac::ExtAddress (#4315)
The `Clear()` method clears the address (set all bytes to zero),
where as the `Fill()` method fills all bytes with a given value.
2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 69d5e084e0 [ip6] use Ip6::Address::Clear() replacing memset to zero (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian f830a8b1ba [mle-tlvs] add LeaderDataTlv::Clear() (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian 173d545466 [netif] add Clear() to netif unicast/multicast address types (#4315) 2019-12-04 12:42:33 -08:00
Abtin Keshavarzian e17c82b0b9 [linked-list] adding LinkedList class (#4357)
This commit adds a linked list module which provides a template
implementation of a singly linked list. The new class is then used in
different core modules (netif (unicast/multicast addresses), UDP6
sockets/receiver, coap resources, etc). This commit also adds a
unit test `test_linked_list` for the linked list module.
2019-12-04 11:03:52 -08:00
Jonathan Hui 15e26f0e64 [examples] add stub for otPlatSettingsDeinit to settings_ram.c (#4378) 2019-12-04 08:54:13 -08:00
Jonathan Hui 4e73575703 [ip6] prefer RLOC source with RLOC dest in SelectSourceAddress() (#4377)
Prefer ML-EID for any mesh-local traffic that does not have RLOC
destination.

Credit to Rongli Sun <rongli@google.com> for identifying this issue.
2019-12-04 08:23:07 -08:00
Jonathan Hui b22f00aea9 [ip6] limit to source prefix length in SelectSourceAddress() (#4377)
RFC 6724 Section 2.2 states:

   We define the common prefix length CommonPrefixLen(S, D) of a source
   address S and a destination address D as the length of the longest
   prefix (looking at the most significant, or leftmost, bits) that the
   two addresses have in common, up to the length of S's prefix (i.e.,
   the portion of the address not including the interface ID).  For
   example, CommonPrefixLen(fe80::1, fe80::2) is 64.
2019-12-04 08:23:00 -08:00
Jonathan Hui d12246d2ee [ip6] reduce scope of local vars in SelectSourceAddress() (#4377) 2019-12-04 08:22:49 -08:00
Yakun Xu 0b49ea2b83 [posix-app] remove dependency on OPENTHREAD_TARGET_DEFINES (#4375) 2019-12-04 08:20:09 -08:00
Jonathan Hui 832944a94a [docs] update CLA text (#4373) 2019-12-04 03:57:41 +08:00
Rongli Sun 2b8586925d [mle] MTD prioritizes ML-EID registration (#4368)
This commit ensures that the important ML-EID would be the
first one in Address Registration TLV so that the parent
would always be able to store it.

(SPEC-899: A recipient MUST process address entries in an
Address Registration TLV sequentially from first entry to
last entry)
2019-12-04 02:50:55 +08:00
Zhanglong Xia 7fdd85b687 [posix-app] optimize the interface between radio_spinel and hdlc_interface (#4352)
This commit simplifies the API between RadioSpinel and HdlcInterface
to improve extensibility of the API so that we can easily add other
low layer interfaces to send/receive spinel frames later.

RadioSpinel is only responsible for encoding/decoding spinel
frames. Lower layer interface is only responsible for
sending/receiving spinel frames. Some lower layer interfaces can't
provide a file descriptor for RadioSpinel to wait for the file
descriptor to become writable, so this commit removes the
kStateTransmitPending state from RadioSpinel.c and directly calls the
function Request() to send frames in method RadioSpinel::Transmit().
2019-12-04 01:14:00 +08:00
Yakun Xu 4a4a1a349f [posix-app] add log level argument (#4336) 2019-12-04 00:54:27 +08:00
Jonathan Hui 2a94525196 [mle] change IsFullThreadDevice to IsRouterEligible where appropriate (#4363) 2019-12-03 09:28:35 +08:00
Jonathan Hui e2723f6c05 [mle] add return error to otThreadSetRouterEligible (#4363)
When trying to set router-eligible and the device is not capable of
becoming a router, return OT_ERROR_NOT_CAPABLE.
2019-12-03 09:28:35 +08:00
Jonathan Hui 27f5d9a06e [mle] rename RouterRoleEnabled to RouterEligible (#4363) 2019-12-03 09:28:35 +08:00
Jonathan Hui 7e6446b927 [mle] keep State Update Timer running on FTD (#4363)
The existing code did not keep the State Update timer running if the
device was not router-eligible. However, a Full End Device (FED) needs
to keep the State Update timer running to maintain its links to
neighboring routers.

This commit ensures that the State Update timer continues to run on
FTD devices, even if the device is operating as a FED. This commit
also removes some unncessary code to start the State Update timer if
the device switches from a FED to a REED.
2019-12-03 09:28:35 +08:00
Yakun Xu df5f46dfc0 [mac] fix typo in data poll sender (#4371) 2019-12-03 06:38:41 +08:00
Abtin Keshavarzian e4fe479baf [mac] scope timeIeOffset variable to block it is being used (#4369) 2019-12-03 06:38:02 +08:00
Abtin Keshavarzian bec7fb0563 [mac] remove unused method definition (#4369) 2019-12-03 06:38:02 +08:00
Kamil Sroka 2233ae150e [coap] fix response timeout for NON messages (#4372) 2019-12-03 00:58:18 +08:00
Piotr Koziar e5db31162d [nrf528xx] fix freertos mutex casting (#4366) 2019-12-03 00:44:50 +08:00
Kamil Sroka 045d4e05a3 [nrf528xx] remove unnecessary typedef from nrf-config.h (#4365) 2019-12-03 00:43:56 +08:00
Rongli Sun e860009914 [network-data] always support service registration at Leader (#4360)
A Leader should always be able to process service registration.

This commit:

- removes the OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE feature
  flag around code for handling service registrations by the leader.

- support service ALOC forwarding by all router-capable devices.

- adds ability for any device to read service information from the
  network data.
2019-12-03 00:42:46 +08:00
Jonathan Hui 2089716959 [mle] clean up MleRouter::HandleAdvertisement (#4338)
- Ensure there are no side effects if MLE frame counters have not yet
  been syncrhonzied.

- Do not remove stale neighbor until end of processing
  Advertisement. This allows for complete processing of	Advertisement
  if frame counters have already been established.
2019-12-03 00:34:51 +08:00
Jonathan Hui d28da9fad6 [mle] do not remove neighbors in MleRouter::HandleLinkRequest (#4338)
This allows the	device to retain the neighbor entry and	validate
incoming messages before a proper MLE Link Request/Accept exchange has
been completed.
2019-12-03 00:34:51 +08:00
Kamil Sroka 3161e9bac2 [nrf528xx] disable soft source match (#4354)
This causes source match implementation in both utils and platform
code, which may lead to erroneous behaviour if the wrong one is
included by the linker.
2019-11-28 02:07:25 +08:00
Jiacheng Guo 8158343004 [debug] override any existing assert definitions (#4329) 2019-11-27 10:26:20 +08:00
Yakun Xu af73358d3f [android] make Android.mk more extensible (#4359) 2019-11-27 08:18:49 +08:00
Piotr Koziar 3a1e5d145a [nrf528xx] fix unused sExtAddress when OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT=0 (#4361) 2019-11-27 01:16:58 +08:00
Abtin Keshavarzian e04a999028 [radio] change SetCcaEnergyDetectThreshold() to pass by value (#4356) 2019-11-27 01:13:47 +08:00
Kamil Sroka 557c44dc6c [nrf52833] fix nrf52833-mbedtls-config.h location (#4355) 2019-11-27 01:12:26 +08:00
Abtin Keshavarzian 9c6b33b5f2 [code-utils] rename alignment macros to use "OT_" prefix (#4351) 2019-11-26 02:45:47 +08:00
Łukasz Duda f756953819 [nrf528xx] handle overrun error on high baudrates correctly (#4350) 2019-11-26 02:44:22 +08:00
Piotr Koziar 14e4538e5b [nrf528xx] add newline at the end of file (#4348) 2019-11-26 02:42:40 +08:00
Jonathan Hui f0bcd8a1ee [joiner] store network configuration using operational dataset (#4332)
This commit changes the Joiner::HandleJoinerEntrust implementation
to store Thread network configuration parameters in the Active
Operational Dataset. Using the operational dataset stores
configuration parameters in non-volatile memory.

This commit only utilizes Thread network parameters that are useful in
the Thread attach process. For example, parameters such as Extended
PAN ID, Mesh Local Prefix, and Active Timestamp are not useful during
the attach process.
2019-11-26 02:38:54 +08:00
Jonathan Hui 889584c42c [cmake] move generated header file to PROJECT_BINARY_DIR (#4112)
Credit to Robert Lubos for the suggestion.
2019-11-26 00:53:35 +08:00
Ciaran Woodward 11074f7829 [cmake] fix version code generation (#4112) 2019-11-26 00:53:35 +08:00
Ciaran Woodward 45ea461990 [cmake] fix map file generation for cc2538 (#4112) 2019-11-26 00:53:35 +08:00
Robert Lubos e745c94ca6 [cmake] fix external mbedTLS usage (#4112)
In order to use external mbedTLS correctly we need to translate CMake
OT_BUILTIN_MBEDTLS into OpenThread's
OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-11-26 00:53:35 +08:00
Ciaran Woodward 96be52fd38 [cmake] add all important cflags in the toolchain file, remove platform.cmake (#4112)
This is important for allowing cmake to properly configure itself,
knowing what cflags will be passed. Also I removed all of the
public modifications of CMAKE_CXX_FLAGS, to better control where
the flags are actually applied.

The linker file is an exception to the toolchain file, as it
depends on symbols that are declared in the startup file
(startup-gcc.c for cc2538). Therefore it has been added as a
PUBLIC requirement for the cc2538 platform layer.
2019-11-26 00:53:35 +08:00
Ciaran Woodward ac903c3673 [cmake] add missing files (#4112) 2019-11-26 00:53:35 +08:00
Ciaran Woodward a51e501b6a [cmake] create functions.cmake file to abstract useful functions (#4112) 2019-11-26 00:53:35 +08:00
Ciaran Woodward 71b567c329 [cmake] remove unnecessary cmake step (#4112) 2019-11-26 00:53:35 +08:00
Ciaran Woodward e65880ecf3 [cmake] remove unnecessary cmake variable (#4112) 2019-11-26 00:53:35 +08:00
Ciaran Woodward 6a00ea0cdb [cmake] remove directory scoped add_definitions calls (#4112)
These won't work well if a parent project includes openthread as a
subproject, and aren't as well abstracted as the target-based
definitions.
2019-11-26 00:53:35 +08:00
Ciaran Woodward 6cfa2f9bec [cmake] replace dependance on env vars with CMake options (#4112)
Otherwise rebuilding will cause sporadic issues when the environment
variables don't match the initial values. CMake variables are
cached in the CMakeCache file in the build directory, and can be
modified using ccmake. Also this improves cross-platform behaviour
as windows doesn't handle environment variables in the same way
as a posix system does.
2019-11-26 00:53:35 +08:00
Ciaran Woodward 24bd599b45 [cmake] fix platform-utils for cmake (#4112)
platform-utils has a dependency on the core ot library, which was
causing the build to fail. I have resolved this by making
platform-utils an 'object library', which means the object files
will always be used by the linker, preventing the 'smart linker'
errors that occur with ld and cyclic dependencies.

I also provided a static (.a) implementation of the library in case
any non-cmake project wanted to consume the results (at which point
that project can deal with the dependency as it wishes).

So now it is up to the 'platform layer' to include the 'platform utils'
objects inside its own library if it requires them. I have implemented
this for the current cmake example platforms.
2019-11-26 00:53:35 +08:00
Jonathan Hui 3807daa68a [cmake] add initial travis checks (#4112) 2019-11-26 00:53:35 +08:00
Jonathan Hui b598fa337c [cmake] initial implementation (#4112) 2019-11-26 00:53:35 +08:00
Zhanglong Xia 501a190546 [posix-app] remove function "HdlcInterface::IsDecoding()" (#4340)
The function "RadioSpinel::IsSafeToHandleNow()" is finally called by the
function "HdlcInterface::Decode()". However, the variable "mIsDecoding"
is set to TRUE before calling "RadioSpinel::IsSafeToHandleNow()" in
function "HdlcInterface::Decode()". So the function "IsDecoding()"
always return TURE in function "RadioSpinel::IsSafeToHandleNow()". This
commit removes the function "IsDecoding()" to simplify the code.
2019-11-20 21:12:23 -08:00
paragdixit-g 1a501a1840 [build] add a gn based build and corresponding travis script (#4322)
The travis script ensures that build of an openthread-core build with gn
and ninja goes through.
2019-11-20 17:27:56 -08:00
Marven Gilhespie 1da4fdd703 [efr32] change to MG21 NVIC interrupt PRIGROUP_POSITION (#4345) 2019-11-20 10:53:40 -08:00
Abtin Keshavarzian 23e89196c0 [toolchain] remove unnecessary OT_TOOL_ALIGN (#4344) 2019-11-20 10:52:17 -08:00
Duda, Lukasz 4b422a33a0 [nrf528xx] ensure there is no radio pending events after diag is disabled (#4343) 2019-11-20 10:47:47 -08:00
Duda, Lukasz 205842d414 [diag] send frames only from the alarm handler in repeat mode (#4343) 2019-11-20 10:47:47 -08:00
Piotr Koziar 61088c7782 [cli] mac/mle counters reset (#4341)
* Add counters reset cli command
2019-11-19 18:35:06 -08:00
Abtin Keshavarzian ab3a1ef6d4 [logging] remove unused otPlatLogv (#4339) 2019-11-19 18:33:25 -08:00
Yakun Xu 9f2ff3bcbf [build] add flag to enable dynamic logging level (#4335) 2019-11-18 14:48:21 -08:00
Jonathan Hui 88ba64fd17 [travis] enable posix-app-ncp test (#4337) 2019-11-18 09:30:53 -08:00
Abtin Keshavarzian be28486fb7 [network-data] fix how the OnMeshPrefixConfig structs are compared (#4312)
This commit ensures the entire struct size is used when comparing
two `OnMeshPrefixConfig` (`otBorderRouterConfig`) instances from
`NetworkData::ContainsOnMeshPrefixes()` method.
2019-11-14 20:23:56 -08:00
Abtin Keshavarzian badae65876 [network-data] change iterator methods to use reference instead of pointer (#4312)
This commit contains t changes the methods in `NetworkData` class used
for iterating over on-mesh prefix, external router, etc (e.g.,
`GetNextOnMeshPrefix`()) to use reference input variables instead of
pointer type variables.
2019-11-14 20:23:56 -08:00
Rongli Sun b816319a28 [mle] fix unexpected data request (#4326)
This commit compares data version properly according to the device
mode (whether or not requiring full network data), thus avoiding
unexpected data request when receiving MLE advertisement.
2019-11-15 00:29:55 +01:00
Jonathan Hui 13d185bf01 [travis] add arm gcc 9 to build tests (#4323) 2019-11-15 00:29:06 +01:00
Jonathan Hui 9e9f506329 [examples] fix potential unaligned pointer value (#4323)
Fixes applied to cc1352, cc2650, and cc2652 platforms.
2019-11-15 00:29:06 +01:00
Duda, Lukasz 5af6b23e5f [nrf528xx] udpate SoftDevice version to 7.0.1 (#4324) 2019-11-14 20:31:00 +01:00
Duda, Lukasz ca7d0c1dec [nrf528xx] update nrf_802154_radio_driver to version 1.6.0 (#4324) 2019-11-14 20:31:00 +01:00
Duda, Lukasz e3737a915d [nrf528xx] update nrfx to version 1.8.0 (#4324) 2019-11-14 20:31:00 +01:00
Duda, Lukasz c97f545ded [nrf52833] add support for nRF52833 platform (#4324) 2019-11-14 20:31:00 +01:00
Marven Gilhespie 3dbd91aa2b [efr32] dynamic multi-protocol support for MG12 and MG21 (#4321) 2019-11-13 20:42:04 +01:00
Yakun Xu 1626cc4013 [daemon] add readline support to ot-ctl (#4320) 2019-11-13 07:37:52 +01:00
Yakun Xu b95281666d [radio] process tx AES without otInstance (#4318)
`otPlatRadioFrameUpdated()` is declared not to access any state within
OpenThread. However, the current implementation does read the extended
address. This commit moves the AES process into `Mac::TxFrame`, which
is free of `otInstance` and eliminates the current deep callback
stacks when the radio driver wants to process tx AES from interrupt
context.
2019-11-13 07:36:18 +01:00
Łukasz Duda 4758624a7a [doc] clarify mac counters meaning (#4307) 2019-11-13 07:31:43 +01:00
Rongli Sun 6877ee83eb [thci] configure FED by disable routerrole (#4317) 2019-11-13 07:24:50 +01:00
Simon Lin 88df5fb4ac [thci] add delay to joinNetwork and ping (#4319)
Recent updates to the Thread Group Test Harness have caused 5.2.3,
5.5.2 tests to fail.

This commit:
- adds more delay interval to address the Test Harness' change in
  delays
- merge Test Harness' OpenThread THCI change for updateRouterStatus

The reduction in ping delay and joinNetwork delay have caused test
5.5.2 to fail by side affects described in DEV-2008. Even though it is
a Test Harness validation issue rather than an OpenThread THCI issue,
we increase the ping & joinNetwork delay so that we have a more stable
regression environment.

Both 5.2.3 and 5.5.2 pass on Harness 2.0.0 with this commit.
2019-11-12 19:46:36 +01:00
Abtin Keshavarzian 19695b0f8e [ncp] add support in spinel/NCP to generate PSKc from pass-phrase (#4294) 2019-11-12 18:24:11 +01:00
Abtin Keshavarzian 090ed57141 [commissioner] change GeneratePskc to use otPskc/Pskc types (#4294) 2019-11-12 18:24:11 +01:00
Abtin Keshavarzian 09a9aa4e34 [dataset-manager] check the read length from message on reading TLVs (#4313) 2019-11-11 17:53:15 +01:00
Abtin Keshavarzian bd7bd470ed [dataset-manager] simplify checks in HandleSet (#4313)
This commit simplifies the `VerifyOrExit()`/`ExitNow()` failure
checks in `DatasetManager::HandleSet()` by starting the `state`
as `kReject` and setting to `kAccept` after all checks are passed.
2019-11-11 17:53:15 +01:00
Abtin Keshavarzian 07e4e44998 [dataset-manager] append SecurityPolicyTlv when present (#4313)
This commit updates `DatasetManager::SendSetRequest()` to include
the `SecurityPolicyTlv` when it is present in the dataset.
2019-11-11 17:53:15 +01:00
Marven Gilhespie de1a439594 [efr32] fix COAPS switch build error (#4310)
third_party/mbedtls/ecp.c was excluded for mg12 and mg21.
2019-11-11 17:41:16 +01:00
Abtin Keshavarzian 8feaf6de1e [toranj] add test-case covering address cache entry removal on SED attach (#4293)
This test verifies that address cache entry associated with a SED
child addresses is removed from new parent node ensuring we would not
have a routing loop.
2019-11-11 17:40:05 +01:00
Kamil Sroka 8cfc772623 [nrf52840] update nrf_security to 0.9.1 (#4311) 2019-11-09 01:18:41 +01:00
Abtin Keshavarzian 335b305ba8 [tasklet] use circular linked list (#4309)
This commit contains the following changes:
- Changes `TaskletScheduler` to use a circular linked list.
- Adds `Tasklet::IsPosted()` which indicates whether a tasklet
  is posted or not (by checking `mNext` pointer against NULL).
- Simplifies  processing of tasklets from `ProcessQueuedTasklets()`
  by creating a copy of current list and clearing the main list
  (this way, a newly posted tasklet would automatically trigger
  a call to `otTaskletsSignalPending()`).
2019-11-09 01:17:01 +01:00
Abtin Keshavarzian 8b4f3fff31 [dhcp6-client] use NetifUnicastAddress in IdentityAssociation struct (#4308) 2019-11-09 01:10:23 +01:00
Abtin Keshavarzian 11d3d9bbf2 [netif] remove unused type LinkAddress (#4308) 2019-11-09 01:10:23 +01:00
Abtin Keshavarzian e8c64a7469 [key-manager] use Notifier::Update when changing security policy (#4308) 2019-11-09 01:10:23 +01:00
Abtin Keshavarzian 82d044b3d1 [coap] fix typos and format in comments (#4308) 2019-11-09 01:10:23 +01:00
Jonathan Hui c8c26b7ac0 [operational-dataset] only generate active dataset once (#4304)
Add check to see if Active Timestamp already exists in the Active
Operational Dataset. If Active Timestamp exists, do not generate
Active Operational Dataset again.
2019-11-07 04:51:47 -08:00
Rongli Sun 75bb2a9dd1 [address-resolver] update EID-to-RLOC cache when attaching MTD child (#4282)
This commits removes deprecated EID-to-RLOC cache if there is entry for
the unicast address registered by MTD child in case this child switches
its parent.
2019-11-07 04:48:50 -08:00
Abtin Keshavarzian aab693f9c3 [timer] add helper methods for common timer use patterns and simplify code (#4243)
This commit adds helper methods in `Timer` class which cover commonly
repeated use patterns by other modules.

Method `FireAt()` allows a timer to be started with a given fire time.
`FireAtIfEarlier()` (re-)schedules the timer with a given a fire time
only if the timer is not running or if the new given fire time is
earlier than the current fire time.

Modules mle, coap, ip6-mpl, joiner-router, dns-clinet, and sntp-client
are updated to use the new methods.
2019-11-07 04:45:34 -08:00
Abtin Keshavarzian ecf7a7050f [toranj] add test covering wpantund auto add of routes per on-mesh prefix (#4221) 2019-11-07 04:43:27 -08:00
Jing 082c1c79f5 [harness-automation] save case failure times (#4261)
Save failure times for each case for judging if case passes randomly.
2019-11-06 07:03:16 -08:00
Jonathan Hui 56354634b9 [mle] clean up Mle::HandleAdvertisement neighbor handling (#4297)
Avoid redudnant search for neighbor entries.
2019-11-06 07:02:19 -08:00
Jonathan Hui aa76e6c955 [mle] move security checks into message handlers (#4297)
- Mle::HandleDataResponse
- Mle::HandleChildIdResponse
- MleRouter::HandleDataRequest
- MleRouter::HandleTimeSync
2019-11-06 07:02:19 -08:00
Jonathan Hui 4aab013e06 [mle] fix MleRouter::HandleLinkAccept message validation (#4297)
This commit moves the message security check to the top of
MleRouter::HandleLinkAccept.
2019-11-06 07:02:19 -08:00
Jonathan Hui de8033fad4 [mle] fix MleRouter::HandleChildUpdateResponse msg validation (#4297)
This commit moves the message security check to the top of
MleRouter::HandleChildUpdateResponse.
2019-11-06 07:02:19 -08:00
Jonathan Hui 779b7851bf [mle] respond to Child Update Request from non-parent (#4297)
This allows an end device to indicate that it is not a child of	the
Child Update Request transmitter.
2019-11-06 07:02:19 -08:00
Jonathan Hui 7703bad23f [mle] remove redundant GetNeighbor calls in MleRouter::HandleLinkReqest (#4297) 2019-11-06 07:02:19 -08:00
Jonathan Hui 9bcef319bb [mle] fix Mle::HandleChildUpdateResponse message validation (#4297)
This commit moves the message security check to	the top	of
Mle::HandleChildUpdateResponse.
2019-11-06 07:02:19 -08:00
Jonathan Hui ec303c16a4 [mle] include Response TLV when sending Child Update Response (#4297)
This commit always includes a Response TLV in a Child Update Response,
whenever the corresponding request includes a Challenge TLV.
2019-11-06 07:02:19 -08:00
Jonathan Hui ea564113ef [travis] disable arm-gcc-8 until compiler bug is fixed (#4306) 2019-11-06 00:24:05 -08:00
Łukasz Duda 7cd4ffcc2c [nrf528xx] add support for reading state of an output pin (#4302) 2019-11-04 06:47:02 -08:00
Kamil Sroka e98de3f358 [nrf52840] use nrf_security for hardware accelerated cryptography (#4267)
Previously simple CC310 cryptographic accelerator library was used
with the glue layer using MbedTLS _ALT function substitution mechanism.
This solution wasn't well tested from a security point of view.

The new cryptographic library is built from the nrf_security project:
https://github.com/NordicPlayground/nrfxlib/tree/master/nrf_security.
It provides both CC310 libraries with MbedTLS API and special glue layers
for situations where both hardware and software implementation is used
(i.e for AES as the hardware supports only 128bit keys so software is used
for 256bit keys).

The new library is based on the CC312 codebase in a version stated
to be ready for production, however the Nordic Semiconductor ASA
port to make the code base work for CC310 devices is currently given out
in an experimental state. The new library is based on CC312 codebase
because it introduces mbed TLS integration for HW cryptographic
features in Arm CryptoCell devices.
2019-11-04 06:46:03 -08:00
Simon Lin b69f463b3f [cc2538] set frame pending correctly (#4263) 2019-11-04 04:42:48 -08:00
Jonathan Hui fc0c86d384 [configure] use "no" instead of "none" in AC_ARG_WITH (#4298) 2019-11-04 00:04:53 -08:00
Rongli Sun 20220169f8 [thci] remove default guardtime configuration (#4296) 2019-11-04 00:04:39 -08:00
Rongli Sun cde2b1ce4f [key-manager] only start guard timer on switch to next key index (#4296) 2019-11-04 00:04:39 -08:00
Jonathan Hui 16c01d58c0 [third-party] change end of line character from CRLF do LF (#4299) 2019-11-01 20:55:23 -07:00
Kamil Sroka 904a4d6516 [security] use Random::Crypto for challenge generation (#4275) 2019-11-01 10:46:11 -07:00
Simon Lin f942d13334 [mle] remove sleepy child in all roles (#4234)
This commit fixes an issue that indirect messages for sleepy child are
not correctly cleared in some cases.

This issue can cause sleepy nodes unable to reattach for a long time,
or even forever.
2019-11-01 08:50:22 -07:00
wgtdkp 9c54a4ed0e [meshcop] remove redundant message copying (#4254)
This commit removes redundant message copying when a joiner router is
handling a RLY_TX.ntf message.
2019-10-31 21:58:10 -07:00
Jeff Bumgardner ab97703b04 [docs] note that use of the public Heap API is discouraged (#4285) 2019-10-31 21:42:17 -07:00
Jonathan Hui c8eaeba6b4 [third-party] change end of line character from CRLF do LF (#4292) 2019-10-31 15:26:28 -07:00
Abtin Keshavarzian 112d1bb008 [ncp] add support for clearing all/subset of counters (#4286)
This commit adds support in NCP/spinel for clearing counters. It also
adds new `PROP_CNTR_ALL_IP_COUNTERS` property to get all IPv6
counters. All (MAC, MLE, IPv6, and NCP) counters can be cleared by
writing (`PROP_VALUE_SET` with any value) to `SPINEL_PROP_CNTR_RESET`
property. A specific subset of counters (MAC, MLE, IP) can be cleared
by writing (any value) to the corresponding spinel property
(`ROP_CNTR_ALL_MAC_COUNTERS`, `PROP_CNTR_MLE_COUNTERS`, or
`PROP_CNTR_ALL_IP_COUNTERS`).
2019-10-31 15:23:22 -07:00
Abtin Keshavarzian 7d80c16df8 [link] add public OT API otLinkResetCounters to reset MAC counters (#4286) 2019-10-31 15:23:22 -07:00
Abtin Keshavarzian bf03f40bd7 [mesh-forwarder] add method ResetCounters to clear IP counter (#4286)
This commit also adds a public API `otThreadResetIp6Counters()`.
2019-10-31 15:23:22 -07:00
Abtin Keshavarzian 795cd14f8c [mac] Adding SetTemporaryChannel()/ClearTemporaryChannel() (#4283)
This commit adds new method in `Mac` namely `SetTemporaryChannel()`
and `ClearTemporaryChannel()` to allow user to temporarily change the
radio channel and use a different channel (during receive) instead of
the PAN channel (from `SetPanChannel()`). A subsequent call to
`ClearTemporaryChannel()` would clear the temporary channel and adopt
the PAN channel again. The new implementation replaces and simplifies
the previous `<Acquire/Release>RadioChannel()` model.
2019-10-31 12:58:01 -07:00
Abtin Keshavarzian 21da048a00 [mac] add Mac::GenerateRandomPanId() (#4283)
This commit adds a helper function `Mac::GenerateRandomPanId()` which
generates a random PAN Identifier (excluding the broadcast PAN Id
`kPanIdBroadcast`).
2019-10-31 12:58:01 -07:00
Jonathan Hui a1cf4397ae [posix-app] fix implementation of CCA ED threshold config (#4295) 2019-10-31 12:56:03 -07:00
Marven Gilhespie abd1875957 [efr32] fix LED gpio port and pin allocation for BRD4166A (#4277)
This bug is inherited from SDKv2.6v bspconfig.h which is also incorrect.
2019-10-31 08:51:49 -07:00
Kamil Sroka 67f4357c5d [nrf528xx] add NRFX timer configuration to sdk_config.h (#4288) 2019-10-30 11:01:52 -07:00
Kamil Sroka f24b1860a9 [nrf528xx] add nrf5AlarmGetRawCounter (#4287) 2019-10-30 11:00:30 -07:00
Rongli Sun fce4508e2f [mle] remove redundant RemoveChildren when router id changes (#4281) 2019-10-30 10:58:12 -07:00
Abtin Keshavarzian efd9ebaa9c [notifier] add Update method (#4274)
This commit adds a new `Notifier::Update()` method which performs a
commonly used pattern in the code where a variable is updated with a
new given value and if the variable value does change a related
notifier `OT_CHANGED_<NAME>` is signaled.
2019-10-29 13:29:38 -07:00
Jonathan Hui fd57343641 [neighbor] add methods to check neighbor state (#4280) 2019-10-29 09:05:36 -07:00
Rafał Kuźnia 5a7e19062c [mac] add option to change direct/indirect TX retry number (#4256)
Add MAC option to change number of direct TX retries:
- add member variable containing maximum number of direct TX retries
- add getter/setter methods

Add public API for direct and indirect TX retries
- otLinkGetMaxFrameRetriesDirect
- otLinkSetMaxFrameRetriesDirect
- otLinkGetMaxFrameRetriesIndirect
- otLinkSetMaxFrameRetriesIndirect

Add NCP support for direct and indirect TX retry configuration.

Rename config definition for direct and direct TX retries.

Add cli command handler for direct and indirect TX retries.
2019-10-29 09:04:26 -07:00
Abtin Keshavarzian aa6318b4dd [toranj] add option to build script to enable tests (#4257) 2019-10-28 21:00:34 -07:00
Abtin Keshavarzian 68d2b8e2f9 [netif] use OT_ARRAY_END() when iterating over external address arrays (#4242) 2019-10-28 20:57:21 -07:00
Abtin Keshavarzian 48973e10e8 [slaac-address] use OT_ARRAY_END macro (#4242) 2019-10-28 20:57:21 -07:00
Marven Gilhespie a718c4e170 [efr32] Added otSysEventSignalPending and NVIC configuration to efr32mg21 (#4279) 2019-10-28 14:09:20 -07:00
Marven Gilhespie 13f138284f [efr32] move __START definition to Makefile-efr32mgxx makefiles (#4278)
Allows external projects to use SDK library generated in OpenThread
with constructors called at startup.
2019-10-28 14:07:47 -07:00
Abtin Keshavarzian 988dc85639 [mac] adding mac_types.hpp/cpp (#4276)
This commit add `mac_types` module which includes definitions for
different MAC types such as PanID, Address, Extended PAN Identifier,
Network Name, etc. These definitions are moved from `mac_frame` into
new the newly added files.
2019-10-28 08:55:48 -07:00
Yakun Xu 9cb3fa50ef [cli] get preferred and supported channel mask (#4253) 2019-10-24 22:30:34 -07:00
Kamil Sroka 7fddb6c9db [heap] export heap API (#4143) 2019-10-24 22:28:51 -07:00
konradderda c3ca842658 [nrf528xx] add wildcards to PRETTY_FILES list for nrf528xx sources (#4272) 2019-10-24 22:27:00 -07:00
Rongli Sun eac27c0f45 [cli] add hex string payload for udp send (#4241) 2019-10-24 10:33:08 -07:00
Abtin Keshavarzian ed8c9f18df [mac] set tx frame as empty when tx aborted during frame preparation (#4265)
The TxDone callbacks can be invoked with `OT_ERROR_ABORT` from two
different paths: Either when OpenThread itself cannot prepare the tx
frame (e.g., message was removed while waiting for MAC to handle a tx
request and ask next layers to prepare the frame) or when the radio
platform itself need to abort the tx.

This commit changes the code such that in the first case, the frame
length is set to zero to mark it as empty. The empty frame helps
differentiate between the two cases and ensures that a previously tx
frame is not incorrectly used from the TxDone callbacks.

The TxDone callback handlers (in `MeshForwarder`, `DataPollHanlder`,
`IndirectSender` and `DataPollHandler` are updated to check for frame
not being empty when processing the frame.
2019-10-24 08:46:54 -07:00
Jonathan Hui aaafa1a480 [fuzz] add stub for CCA ED radio APIs (#4269) 2019-10-23 20:07:11 -07:00
Krzysztof Taborowski 4871f12645 [third-party] change end of line character from CRLF do LF (#4250)
Also remove .gitattibutes from third-party
2019-10-23 12:31:02 -07:00
Yakun Xu c4e7156f41 [coap] force set message id for CON and NON types (#4255) 2019-10-22 11:37:57 -07:00
Zhanglong Xia 5858bd1d28 [spi-hdlc-adapter] remove unused variables (#4252) 2019-10-22 11:24:52 -07:00
konradderda fb14009916 [radio] handle CCA ED threshold property configuration (#4246)
Changes:
- Radio interface simply passes calls to platform functions
- Platform implementation for nRF52840 and nRF52833
- Placeholders for other platforms (resulting with
  OT_ERROR_NOT_IMPLEMENTED)
- Spinel property configuration handlers
2019-10-16 10:50:26 -07:00
Zhanglong Xia 3f2c2290ac [efr32mg12] update the channel range of channel config entry (#4214) 2019-10-16 10:47:09 -07:00
Abtin Keshavarzian 233f8406e3 [topology] remove unused (non const) GetExtAddress() method (#4249) 2019-10-15 21:40:59 -07:00
Abtin Keshavarzian 956fa518a7 [tests] update test_child to use Clear() instead of memset (#4248) 2019-10-15 15:46:17 -07:00
Li Cao 0e45ba6d77 [tests] fix the wrong port of dtls (#4244) 2019-10-15 10:18:04 -07:00
Yakun Xu 45be16f86e [posix-app] make set an atomic operation (#4235) 2019-10-15 09:07:21 -07:00
Simon Lin ca798e267d [coap] optimize call to GetMatchedResponseCopy (#4182)
Method ResponsesQueue::EnqueueResponse was using
GetMatchedResponseCopy to check if matched response already exists in
the cache. The code might clone message only to release it right away,
which is not efficient.

This commit:

1. Adds a new method ResponsesQueue::FindMatchedResponse which tries
   to find and return the matched response in the queue, without
   cloning the message

2. Optimize EnqueueResponse by using FindMatchedResponse

3. Re-implements GetMatchedResponseCopy using FindMatchedResponse to
   to reduce code redundancy.
2019-10-14 21:05:55 -07:00
Zhanglong Xia d9e333e091 [travis] add library size report support (#4239) 2019-10-14 10:28:49 -07:00
wgtdkp 69e23e2c60 [mbedtls] fix wrong ECDSA enabling macro (#4238) 2019-10-14 10:27:56 -07:00
wgtdkp ff789e4ded [api] add API to get Thread Version (#4225) 2019-10-14 10:24:30 -07:00
Zhanglong Xia ea0cc8f3bb [nrf528xx] correct the link of nRF5 Command Line Tool in README (#4236) 2019-10-11 09:58:21 -07:00
Yakun Xu f7801c7fab [coap] remove otCoapMessageSetMessageId() (#4227)
Message ID is managed by CoAP agent. Allowing user setting it may
result in invalid usage. This commit removes this API and adds a new
API to initialize CoAP response message.
2019-10-11 09:53:41 -07:00
Yakun Xu f691ea3edf [examples] provide APIs to manipulate 802.15.4 frames (#4156)
This commit exposes utility functions for radio drivers to manipulate
MAC frames.
2019-10-11 09:50:20 -07:00
Simon Lin 28ffcd1bc6 [posix] always set ACK FP for data requests when SrcMatch is disabled (#4232) 2019-10-10 10:08:36 -07:00
Jonathan Hui 98fb9dfaf4 [instance] fix typo in OT_CHANGED_IP6_MULTICAST_* (#4230) 2019-10-09 15:01:32 -07:00
Łukasz Duda 00fa340747 [nrf528xx] change casting type to remove SES warning (#4229) 2019-10-09 08:50:29 -07:00
wgtdkp 350b83acb0 [udp] suppress warning of unused parameter (#4228) 2019-10-09 08:49:47 -07:00
Zhanglong Xia 96e1ffa307 [posix] use common source match table implementation (#4160) 2019-10-09 08:44:19 -07:00
Jing 0d9263cc0e [harness-automation] update to support both external and internal Test Harness (#3883)
1. add new role support for border router and its 8 cases 7.1.x

2. update cases referring to Test Harness v50.x

3. for version larger than R1.4.0, not trigger saving results
   web-operation since it will auto save.

4. use "python3 -m black -l 119 -S" to format harness-automation
   directory

5. correct required golden device numbers
2019-10-09 08:42:09 -07:00
Yakun Xu 862a2b3d02 [script] use python version specified in test script (#4226) 2019-10-08 09:29:27 -07:00
Simon Lin cc91b2c72b [mle] fix MleRouter::UpdateRoutes (#4146)
- Move updating link quality ahead of updating routes to fix potential
  wrong routing path switch

  - In each do-while loop, the method traverse each router id and
    update the routing path to the router (RU) according to new
    Route64 TLV received from the neighbor, and also update link
    quality out to the neighbor (LU) when the router id is that of the
    receiver. So, there could be RUs before LU and also after LU. The
    RUs before LU are using wrong link quality to the neighbor for
    comparison, thus could cause lower cost routing path be replaced
    by higher cost routing path or even lost.

  - This commit moves LU ahead of RUs to make sure all RUs are using
    correct link quality to the neighbor for calculation.

- Remove the unnecessary do-while loop

  - The do-while loop is unnecessary after LU is moved.

  - For each RU, the calculation depends on following factors:

    - F1: Routing cost to the router using current nexthop

    - F2: Routing cost to the router using the neighbor as nexthop

  - So, each RU is independent of each other, and all RUs can be
    updated in one loop.

- Skip RU when router == neighbor is satisfied

  - The original RU code actually do nothing when router == neighbor
    is satisfied. Real routing updates only happen in if (router !=
    neighbor) blocks.

  - Logically speaking, the routing path to the neighbor can not be
    updated by processing Route64 TLV from the neighbor itself.

  - By skipping earlier, the code is more clear and easier to
    understand.

- Replace (cost + mRouterTable.GetLinkCost(*neighbor) <=
  kMaxRouteCost) with (cost + mRouterTable.GetLinkCost(*neighbor) <
  kMaxRouteCost)

  - Even through the routing path with cost == kMaxRotueCost can be
    established, it will never be utilized in the current OT
    implementation. In method MleRouter::GetNextHop, nexthop is only
    used if ((routeCost + GetLinkCost(router->GetNextHop())) <
    linkCost). Since linkCost <= kMaxRouteCost, nexthop with routing
    path cost >= kMaxRouteCost will never be used.

  - Use cost < kMaxRouteCost to indicate finite routing cost and cost
    >= kMaxRouteCost to indicate infinite routing cost for consistency
2019-10-08 09:21:00 -07:00
Jonathan Hui 386746b1bf [travis] switch to ubuntu bionic (#4222) 2019-10-07 13:56:05 -07:00
Łukasz Duda 1de6a3dfda [toolchain] add definition of UINT16_MAX (#4224) 2019-10-07 13:55:39 -07:00
Abtin Keshavarzian fb2de8fe45 [sntp-clinet] remove memset(zero) from constructors (#4195) 2019-10-04 15:35:53 -07:00
Abtin Keshavarzian c1d123d177 [mle] remove memset from DelayedResponseHeader constructors (#4195) 2019-10-04 15:35:53 -07:00
Abtin Keshavarzian 26743fae04 [dns-client] remove memset(zero) from constructor (#4195) 2019-10-04 15:35:53 -07:00
Abtin Keshavarzian 726d8e96e3 [core] make metadata (saved in Message) non-packed (#4195) 2019-10-04 15:35:53 -07:00
Abtin Keshavarzian c5d4fc5cbe [topology] adding Child:Clear() and Router::Clear() (#4195) 2019-10-04 15:35:53 -07:00
Abtin Keshavarzian 4feadec950 [time] adding Time class (#4195)
This commit adds `Time` class which represents an instance of time
(it is a simple wrapper over a `uint32_t` corresponding to a
numerical time value). The `Time` class provides helpful operator
overloads:
- Operators `+` and `-` with a `Time` instance and a `Duration` to
  get a `Time` instance after or before.
- Operator `-` with two `Time` instances to calculate the `Duration`
  duration between two time instances.
- Operators `<`, `<=`, `>`,'>=', '==' and `!=` to compare two `Time`
  instances. They correctly handle the wrapping of numeric time value.

The core modules are updated to use the new `Time` and `Duration`
types which help make the code simpler. This commit also updates the
 unit test `test_timer` to add test cases for newly added types.
2019-10-04 15:35:53 -07:00
Jonathan Hui 43be2b821f [tests] require python3 and drop support for python2 (#4220) 2019-10-04 11:03:58 -07:00
Marven Gilhespie 43c8a709db [efr32] add radio.c debug counters for efr32mg12 and efr32mg21 (#4217)
Also adds Silicon Laboratories, Inc. to AUTHORS file.
2019-10-04 11:03:18 -07:00
Abtin Keshavarzian 3888226c3f [toranj] add test covering wpantund host route management feature (#4218) 2019-10-04 09:39:00 -07:00
Rafał Kuźnia 3a248f649a [nrf52840] add UART and BLE bootloader support (#4212)
This commit introduces serial and BLE DFU bootloader support
* Added new linker script for serial and BLE DFU bootloaders
* Added new nRF52840 switches (BOOTLOADER_USB/UART/BLE)
* Deprecated BOOTLOADER=1 switch
2019-10-02 10:53:42 -07:00
Rongli Sun d40b273a84 [mesh-forwarder] support DHCP traffic forward when DHCP is disabled (#4219) 2019-10-02 10:21:21 -07:00
Jonathan Hui 378183e21e [tlvs] use uint32_t for TLV size to avoid overflows (#4216) 2019-10-01 08:36:39 -07:00
Abtin Keshavarzian 86b3cfef56 [mac-frame] set kMtu from config param and inline simple getters (#4215) 2019-10-01 08:36:20 -07:00
konradderda f657451951 [nrf528xx] always enable NRF_MBEDTLS_AES_ALT_INTERRUPT_CONTEXT (#4210)
If all of COMMISSIONER/JOINER/TIME_SYNC switches are not enabled and
CC310 is not disabled, RNG always produces the same values (even after
issuing a reset). This is caused by mbed TLS library which by default
uses 256 keys internally but CC310 AES module can handle only 128 bit
keys. We can enable NRF_MBEDTLS_AES_ALT_INTERRUPT_CONTEXT options for
all configurations to enable software implementation when keys longer
than 128 bits are used.
2019-10-01 08:35:27 -07:00
Abtin Keshavarzian f29a2f1257 [mac] prioritize a pending poll tx after handling of frame tx (#4211)
This commit ensures to prioritize a pending poll tx request after
handling a (direct) frame tx request. This addresses the situation
where back-to-back frame tx requests could have delayed a data poll
tx request.
2019-09-27 10:19:43 -07:00
konradderda 2dedd82ef3 [nrf528xx] change directory structure for nrf528xx family (#4206)
Merged nrf528xx sub-directories to simplify maintenance and porting of
new nrf528xx family platforms in the future.

Crucial changes:

- Moved all source files to common 'src' directory

- Merged all *.c files and treated platform specific fragments of code
  with conditional compilation

- Created simple automake file
  [examples/platforms/nrf528xx/Makefile.am] that includes
  conditional-include blocks
2019-09-27 10:17:29 -07:00
Abtin Keshavarzian 51217542ba [commissioner] log commissioner state changes (#4207) 2019-09-25 16:33:22 -07:00
Abtin Keshavarzian 900764d2ee [commissioner] make simple getter methods inline (#4207) 2019-09-25 16:33:22 -07:00
Abtin Keshavarzian 9aed664596 [commissioner] update how Provisioning URL is stored (#4207)
This commit updates how the `Commissioner` stores the Provisioning URL
(now saved as null terminated string). It also updates the related
APIs (including the public `otCommissionerGetProvisioningUrl`) and its
use in `NcpBase`.
2019-09-25 16:33:22 -07:00
Abtin Keshavarzian 621ad11055 [commissioner] iterate over joiners using pointer (#4207) 2019-09-25 16:33:22 -07:00
Yakun Xu fff7a38cf1 [build] fix missing definitions in configure.ac (#4201)
This commit adds missing definitions in configure.ac to fix configure
with options like `--disable-FEATURE`. This is because some features
are enabled by default, if missing defining as `0`, the
`--disable-FEATURE` will not work.
2019-09-25 16:30:14 -07:00
huamenggg 6cfb4162d7 [coap] add IsBound() check in Coap::Send (#4205) 2019-09-24 10:35:58 -07:00
huamenggg a1cffd2545 [platform-netif] set link type to void (#4198)
This commit sets link type to void so that only one link-local
address will exist.
2019-09-21 02:19:10 +08:00
Jonathan Hui 8be8bf1fdf [meshcop] improve HandleCommissioningGet implementation (#4194)
- Fix insufficient length checks.
- Avoid using a large stack buffer.
2019-09-20 14:39:49 +08:00
Abtin Keshavarzian 4916f1c0c5 [mac] add Mac::NetworkName class (#4169)
This commit adds `Mac::NetworkName` class as C++ wrapper over the
`otNetworkName`. It also adds `NetworkName::Data` to represent the
network name as a pointer to a char array buffer (not necessarily null
terminated) with a given length. This representation is used by
`Mac::BeaconPlayload` and `MeshCop::NetworkNameTlv`. This commit also
adds a unit test for `Mac::NetworkName` class.
2019-09-20 14:39:28 +08:00
Simon Lin bf2ad6d166 [posix-sim] add method route_list & route_table to Node (#4142)
This commit implements the router_list and router_table methods for
Node in simulator.

This commit also includes a simple test to verify correctness.
2019-09-20 14:38:29 +08:00
Yakun Xu 6fd3a24a43 [coap] add message free on error in Cli::CoapSecure::DefaultHandler (#4193) 2019-09-20 05:36:05 +08:00
Zhanglong Xia c81fc67b82 [api] change commissioner API from c++ style to c style (#4192) 2019-09-19 23:09:48 +08:00
huamenggg 05eb406106 [dataset] support pskc in DatasetManager::SendSetRequest (#4189) 2019-09-19 22:32:58 +08:00
Yakun Xu addaefe5e1 [build] no feature defines in config.h (#4157) 2019-09-19 15:13:23 +08:00
Abtin Keshavarzian 1f6c85cb69 [commissioner] use Mac::ExtAddress helper methods (#4181) 2019-09-19 15:12:04 +08:00
Abtin Keshavarzian 48b64f8d30 [address-resolver] use ExtAddress helper methods (#4181) 2019-09-19 15:12:04 +08:00
Abtin Keshavarzian d81af29640 [ip6-address] use ExtAddress helper methods (#4181) 2019-09-19 15:12:04 +08:00
Abtin Keshavarzian 20145cb42f [core] always implement operator != in terms of == (#4188) 2019-09-18 19:13:11 -07:00
Abtin Keshavarzian 1555b21910 [key-manager] add Pskc class (#4174)
This commit adds a `Pskc` as a wrapper over `otPskc` and also
renames all the uses of `PSK` into `Psk` to follow our variable
and type naming convention which treats an acronym as a whole
word.
2019-09-18 19:11:07 -07:00
huamenggg 1ac791b79d [posix-app] allow pseudo reset (#4184) 2019-09-18 07:47:30 -07:00
huamenggg 6d1981b112 [commissioner] add GetNextJoinerInfo() function (#4179) 2019-09-18 07:46:37 -07:00
Jonathan Hui bb56fa906a [meshcop] enforce max length on commissioner id (#4178) 2019-09-17 17:11:49 -07:00
Jonathan Hui 68426e236f [network-data] set max length to 254 (#4177)
As specified by Thread Conformance Specification.
2019-09-17 17:11:29 -07:00
Jonathan Hui 767a8eb9bb [tlvs] add length check in Tlv::Find for extended tlvs (#4176) 2019-09-17 17:11:15 -07:00
Stuart Longland ebf665eb6a [cc2538] interrupt driven radio driver (#4137)
- Add a configuration flag that enables the reception of 802.15.4
radio frames by way of a hardware interrupt so that frames are not
missed whilst the CPU is busy processing something else.

- Move otPlatRadioGetPromiscuous into separate function. The only
place `readFrame` uses `aInstance` is when calling
`otPlatRadioGetPromiscuous`, which then ignores `aInstance` anyway.
So make a private function that reads the hardware register which
`readFrame` and `otPlatRadioGetPromiscuous` can call.

- Use cc2538RadioGetPromiscuous in readFrame. This allows us to drop
the problematic `aInstance` pointer. Whilst we're here, make the
function `static` since nothing else outside of `radio.c` calls it.

- Call readFrame on incoming data. If the interrupt fires, call
`readFrame` to pull that data in. When polling, also check (with the
interrupts disabled) just in case.

- Enable correct NVIC interrupt. `startup-gcc.c` enables alternate
interrupt mappings, which places the radio receive interrupt at number
26; which is in the very first register.

- Avoid debug logs in receiveFrame. If we call this method from an
interrupt handler, we want to avoid calling `snprintf` and similar
functions as these are generally not interrupt-safe. Instead, use an
extra byte of RAM to store the number of bytes dropped so we can log
it from a safe context. This is only needed when both interrupts _and_
platform logging are enabled.
2019-09-17 17:10:01 -07:00
Jeff Bumgardner 992ca4fdda [docs] update Doxygen groupings for new APIs (#4166) 2019-09-17 09:39:14 -07:00
Yakun Xu 3d9480c99a [posix-app] log filename when die (#4155)
This commit aims at adding the filename when die.

Other enhancements:
- Enable PLATFORM region by default for posix-app
- Disable warning for zero variadic macro arguments
- Use VerifyOrExit to implement other assert utilities
- Do not call fprintf() and print exit code in assert utility

To print dying message to stderr, add -v when launching the app.
To get the exit code, use echo $? just after the app died.
2019-09-17 09:38:17 -07:00
Yakun Xu 69f173ebae [posix-app] fix crash on os ifconfig down (#4171)
This commit fixes a crash issue triggered by system command ifconfig
down.  This is because OpenThread's tries removing addresses when the
platform network interface is already down.
2019-09-17 04:05:02 -07:00
huamenggg 9a0ef5304a [meshcop] add IsBound check in JoinerRouter::HandleStateChanged (#4170) 2019-09-17 01:41:10 -07:00
Simon Lin ff66a71c6a [coap] finish cached coap response before sending (#4175) 2019-09-17 01:37:07 -07:00
Zhanglong Xia c0ef327664 [radio] add radio coex control api (#4158) 2019-09-16 23:12:37 -07:00
Jonathan Hui 87ef3b1d51 [cli] avoid NULL dereference with udp send -s 0 command (#4164) 2019-09-16 18:08:47 -07:00
Yakun Xu e4dc606ec8 [script] add a script to make source pretty (#4167)
This commit adds a script to make source pretty in a temporary
directory.
2019-09-16 18:08:29 -07:00
Abtin Keshavarzian 3514458d5d [tlv] handle Extended TLV and simplify searching for TLV in a message (#4152)
This commit contains the following change in `Tlv` class:

- Changes `GetSize()`, `GetValue()` and `GetNext()` to ensure they
  work correctly independent of whether the TLV is an Extended TLV
  or not.
- Defines a new common private static method `Tlv::Find()` which
  is then used to simplify `Tlv::Get()` and `Tlv::GetOffset()` and
  `Tlv::GetValueOffset()` implementations.
- This change also ensures `Tlv::Get()` (which finds and reads a
  TLV of a given type within a message) work correctly for Extended
  TLVs.
2019-09-12 09:30:22 -07:00
Łukasz Duda 0e489b07e2 [network-diagnostic] limit number of entries in Child Table TLV (#4163)
This commit fixes Thread Certification Test Case Router_5_7_3 where
Child Table TLV was damaged.

This commit also ensures that only Base TLV format is used.

The bug was introduced introduced in d796b0.
2019-09-12 09:20:21 -07:00
Simon Lin 4dc58da927 [mle] always echo back AR TLV in Child ID/Update Response (#4162)
This commit ensures that a Child ID/Update Response message always
includes an Address Registration TLV when the Child ID/Update Request
message	includes an Address Registration TLV, even when there are no
IPv6 addresses to include.

This commit reverts a change in commit 1133983.
2019-09-12 08:51:39 -07:00
Yakun Xu 8595924e6c [utils] remove stdint and stdbool wrappers (#4154)
This commit removes the wrap_stdint.h and wrap_stdbool.h because
OpenThread enforces C99, which includes these headers in its standard
library.
2019-09-11 11:17:02 -07:00
huamenggg 050682ddc3 [tmf] add method to read entry from ChildTableTlv (#4147)
This commit add a method to read entry from ChildTableTlv. The
GetEntry() cannot be used because the current read ChildTableTlv
operation doesn't read child table entries.
2019-09-11 11:09:55 -07:00
Yakun Xu 957d79d786 [api] force linker failures when using disabled features (#4127) 2019-09-10 08:42:02 -07:00
Abtin Keshavarzian 0b220613ab [key-manager] add MasterKey class (wrapper over otMasterKey) (#4150)
The `MasterKey` class mainly provides overloads of operators `==`
and `!=` which help simplfy the code comparing keys.
2019-09-09 18:07:41 -07:00
Abtin Keshavarzian 472a03af88 [mac-frame] helper methods to copy ExtAddress in normal/reverse byte order (#4144)
This commit updates `Mac::ExtAddress` and `Mac::Address` to add
helper methods to copy address from/to a byte array in normal or
reverse bye order. This commit also adds a unit test for the two
Address classes.
2019-09-09 17:13:06 -07:00
Abtin Keshavarzian 276d866935 [mac] add Mac::ExtendedPanId type (wrapping otExtendedPanId) (#4149) 2019-09-09 17:03:06 -07:00
Kamil Sroka ad6af37d99 [crypto] don't add entropy source if it's done by mbedTLS (#4140)
If platform uses MbedTLS feature to add entropy source during context
init (by platform entropy, HAVEGE or MBEDTLS_ENTROPY_HARDWARE_ALT) we
shouldn't add second entropy source. This saves time and power as we
don't have to poll two different entropy sources/poll same entropy
source twice.
2019-09-09 09:23:05 -07:00
Jonathan Hui a154692422 [cli] add error check to udp send command (#4148) 2019-09-08 21:40:15 -07:00
Abtin Keshavarzian 7761d3cc21 [toranj] add test to verify child sending data poll within its timeout (#4136)
This commit adds a `toranj` test-case. This test covers the situation
where the data poll interval is set to a value larger than child's
timeout interval. The test verifies that the sleepy child would send a
data poll within its timeout interval (ensuring that child stays in
parent's child table).
2019-09-08 21:37:52 -07:00
Abtin Keshavarzian 5e33f42f15 [data-poll-sender] always honor the default child timeout based poll interval (#4136)
This commit changes the `DataPollSender` to ensure that a child device
will always send a data poll within its timeout interval. This
addresses an issue where a large user-specified poll period could
cause the device to adopt a poll period longer than the default child
timeout (causing parent to kick the child out of its child table).

This commit also simplifies the selection code for a new poll period
by adding a helper `UpdateIfLarger()` method to update the period only
if it's larger than a given new value.
2019-09-08 21:37:52 -07:00
Abtin Keshavarzian a11dafb686 [network-diagnostics] use the child timeout directly (#4136)
This commit changes the `NetworkDiagnostic::FillRequestedTlvs()` to
directly use the child timeout value in appended `TimeoutTlv`. This
addresses an issue where a user-specified long data poll interval
could cause the timeout TLV in diags response to be set higher than
actual child's timeout value.
2019-09-08 21:37:52 -07:00
wgtdkp 2d3fd3b047 [meshcop] fix sending MGMT_DATASET_CHANGED.ntf to commissioner (#4145) 2019-09-06 09:45:25 -07:00
Simon Lin eb5b42a86e [mle] reset MLE adv timer when cost changes to/from infinite (#4129) 2019-09-04 22:02:26 -07:00
Kamil Sroka e7ea31b16f [crypto] seed PRNG from DRBG when possible (#4141) 2019-09-04 12:06:27 -07:00
Kamil Sroka fac99c7091 [nrf528xx] remove default value for BuildJobs (#4139) 2019-09-04 12:03:56 -07:00
Marven Gilhespie 87105e0694 [efr32] add sleepy demo for efr32mg21 (#4138)
Sleepy Demo added to the efr32mg21 directory.

Updated efr32mg21 alarm.c to use changes for efr32mg12 in commit 89dca58.
2019-09-04 12:02:58 -07:00
Abtin Keshavarzian ef4adde7be [data-poll-handler] always process data poll when acked with "frame pending" (#4131)
This commit removes the extra check remaining from before the change
from #3785 and the related follow-ups. Before having the "Acked with
FP" feature, we relied on number of indirect msg in queue (for the
child) or state of src-match-table to determine/guess if the data poll
was acked with fp or not. That is now redundant and can be incorrect
(e.g., if a message was removed/evicted after data poll was acked with
fp set).

If the data poll is acked with "frame pending" flag set, the child
would stay in rx expecting a frame from parent. If we have no frame
for the child, parent would send an empty frame to let the child know
that it can go to sleep (and avoid the child having a data timeout and
retx the data poll).

This change is required for new platform abstractions like Thread over
BLE (ToBLE) where we may not have the ack or frame-pending notion at
the link layer and rely on next layer to follow a "data poll" with
empty frame (when there is no pending frame).
2019-08-30 13:16:41 -07:00
Simon Lin 3c402a7485 [commissioner] only allow attached device to become commissioner (#4120)
The commit addresses the issue that running "commissioner start"
command when device role is detached will cause commissioner not be
able to start or stop.
2019-08-30 09:04:42 -07:00
Rafał Kuźnia 528e7d5992 [nrf528xx] fix compiler warning (#4135)
sInstance was unused without OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT.
2019-08-30 09:01:45 -07:00
Abtin Keshavarzian ed0939c45a [mac] move static variable definition into Mac class (#4132)
Reasons for this the change:

- Namespace/scope variables under Mac class only.

- Allow us in future to potentially break mac.cpp into multiple files
  (e.g. mac_ftd?).
2019-08-30 09:01:08 -07:00
Simon Lin 45b3baf040 [heap] increase default internal heap size for DTLS (#4130)
Test Case 8.1.1 on cc2538 OT TB has a fail probability of 19% due to
DTLS handshake failure. This commit fixes this issue by increasing
heap size by 128B (6144B -> 6272B), resulting in 100% Pass.
2019-08-30 08:59:28 -07:00
Rongli Sun 4a9b611d05 [core] EID-to-RLOC cache map optimization (#4091)
This commit adds EID-to-RLOC map cache entries by inspecting packets
received, aiming to reduce RealmLocal multicast AQ when response is
expected.
2019-08-30 08:58:16 -07:00
Simon Lin c3be816e07 [thci] fix setXpanId bug and code cleanup (#4121)
This commit fixes a bug where setXpanId might raise exception when
called with xPanId of length 16.

This commit also renames __convertLongToString to __convertLongToHex
to better reflect its functionality and optimizes its implementation.
2019-08-30 08:53:50 -07:00
Ciaran Woodward 3ddc4fe98c [docs] fix reference to old function name in link.h (#4134)
otSetChildTimeout -> otThreadSetChildTimeout
2019-08-29 13:22:09 -07:00
Abtin Keshavarzian 3cd4be9392 [mac] add IsJoinable (private) method (#4133) 2019-08-29 13:21:19 -07:00
Yakun Xu 6b42ce5845 [nrf52840] simple implementation of app_error_handler (#4124)
This commit provides a simple implementation of app_error_handler(),
which resolves the link error with DEBUG=1.

This commit also adds DEBUG=1 flag in CI tests of nrf52840 platform to
prevent this error from happening again.
2019-08-28 12:54:19 -07:00
Christian Stauffer 864e3458f5 [ip6] add IPv6 fragmentation and reassembly support (#3948) 2019-08-28 10:31:55 -07:00
Jiacheng Guo 3198a3be69 [posix] do not exit upon recv getting EINTR (#4126) 2019-08-27 08:39:29 -07:00
Yakun Xu 711c03aa1e [travis] remove postgresql source list (#4125)
Avoid CI failures caused by pgdg.list.
2019-08-27 08:36:05 -07:00
Jonathan Hui 6334107e19 [address-resolver] restart address queries when RLOC changes (#4123) 2019-08-26 10:21:10 -07:00
Hubert Miś f71d88983e [nrf52xxx] update radio driver to version 1.5.0 (#4122) 2019-08-23 10:07:08 -07:00
Jonathan Hui d796b056c5 [child-table] add support for more than 64 children (#4118) 2019-08-23 09:15:37 -07:00
Jintao Lin f3f8654b0f [nrf52xxx] use Rx SFD time in Rx timestamp for promiscuous mode (#4106) 2019-08-23 09:14:50 -07:00
Abtin Keshavarzian 5569ecfa0b [toranj] test-case covering attach between single parent/child with poor link (#4114) 2019-08-22 12:04:12 -07:00
Abtin Keshavarzian 9869ab5df9 [mle] process "Parent Response" from current parent candidate (#4114)
This commit updates MLE to continue to process a repeated
"Parent Response" from current parent candidate to ensure that the
challenge and frame counter are correctly updated.
2019-08-22 12:04:12 -07:00
Yakun Xu 79c61a5700 [diag] clean up unnecessary variables and code (#4102) 2019-08-22 08:38:56 -07:00
Zhanglong Xia 27cac08e8a [radio] add coex metrics (#4108)
- Add platform get coex metrics API
- Add spinel property for coex metrics
2019-08-21 12:25:27 -07:00
Yakun Xu bbd289e278 [posix-app] remove node id from logging (#4110)
* Simplified posix-app logging
* typedef otLogLevel to signed int so that when dynamic logging and
  reference_device is enabled, there will not be always true error.
2019-08-21 09:58:27 -07:00
wgtdkp fcc936fe45 [border-agent] fix appending extended UDP Encapsulation TLV (#4104) 2019-08-20 11:51:02 -07:00
Abtin Keshavarzian 27336a95cf [sub-mac] relax the requirement for TxDone callback (#4113)
This commit changes the `SubMac::BeginTrasnmit()` by moving the call
to `Transmit()` on radio platform after the state change to
`kStateTransmit` (and pcap callback). This relaxes the requirement for
radio platform implementation and allow it to invoke `TxDone` callback
directly from the `Transmit()` call itself (instead of requiring
`TxDone` to be called only after the `Transmit()` call returns).
2019-08-20 08:39:24 -07:00
Yakun Xu 1812d8cfda [build] remove unused definitions from configure.ac (#4109) 2019-08-20 08:38:21 -07:00
Rafał Kuźnia f31c87b46e [utils] add option to use external heap (#4041)
This commit introduces a new API call otHeapSetCAllocFree

The API is available to the application from `heap.h` header and is
enabled when `EXTERNAL_HEAP` common switch is set. The call must be
invoked before the OpenThread instance is initialized.

This allows the OpenThread to use an external heap for allocation, for
example from FreeRTOS.
2019-08-19 12:01:54 -07:00
Abtin Keshavarzian 2a0d6c402f [posix-sim] remove unused variable (#4103) 2019-08-19 07:44:51 -07:00
Jonathan Hui 711598eb17 [cli] fix inconsistent printf format specifier (#4101) 2019-08-19 07:43:18 -07:00
Yakun Xu 979e454117 [posix-app] refine OpenThread POSIX-app API (#4073)
This commit makes it easier to OpenThread POSIX-app as a library.

* Remove ot prefix from non-public platform-specific APIs.
* Avoid main() calls non-public platform APIs.
* Parse arguments outside of POSIX-app library.
* Add option to log to stderr.
* Add LOG_OUTPUT flag
* Delete assert() in RadioSpinel::Receive()
2019-08-15 16:24:15 -07:00
Yakun Xu e1da9f3eee [travis-ci] merge pretty check (#4096)
This commit combines the pretty checks between C/C++ and python into
one job to reduce the number of jobs and save Travis time overall.

This commit also moves pretty check and size report logic from Travis
scripts into a separate script to improve overall usability and
maintainability.
2019-08-15 15:47:52 -07:00
jrodriguez42 7a27590222 [dhcp6] add multicast solicit and accept more general replies (#4076) 2019-08-15 12:31:53 -07:00
wgtdkp a388d6ef33 [border-agent] handle error responses from leader (#4097)
This commit removes an assumption in the border agent that COM_PET.rsp
from the leader 1is CHANGED.  It is possible for the leader to return
a 4.XX error response. In that case, the border agent should forward
the error response.
2019-08-15 08:43:59 -07:00
Yakun Xu cdc3751e59 [diag] fix processing platform command (#4099) 2019-08-14 22:21:58 -07:00
wgtdkp d4bcb16b1d [border-agent] send error responses with correct error code (#4098)
This commit fixes a bug where the border agent does not create error
responses with correct error codes.
2019-08-14 12:37:37 -07:00
Jeffrey Hayes c6d7674b2c [mle] enable state update timer when enabling router role (#4094)
The state update timer should be started when enabling router role and
attached to a network.
2019-08-14 12:34:51 -07:00
Jonathan Hui d0214bffe6 [ip6] fix default source address selection (#4082)
Thread defines a mesh-local scope for IPv6 unicast addresses. However,
the mesh-local scope can only be inferred by inclusion of the
mesh-local prefix.

This commit updates the IPv6 source address selection to infer the
destination address scope based on a prefix match with currently
assigned addresses.
2019-08-14 12:33:36 -07:00
Marven Gilhespie 89dca58915 [efr32] fallback to use relative timer if absolute timer fails to start (#4081)
Added a fallback to the efr32mg12 where if an alarm set with an
absolute expiry time (t0 + dt) has failed to start then we fallback to
using a relative timer (dt).

It has been observed in testing that alarms have stopped working on
the efr32mg12. This has caused other issues such as buffers not being
freed or the network splitting as no further alarms are scheduled.

The cause is due to an alarm being set to expire slightly in the
past. In this case we fallback to using a relative timer using only
the dt value. For the cases where it fails it will be set to 1ms into
the future from the time the RAIL_SetTimer is called.

RAIL maintains time in microseconds but is being rounded down for the
time returned in milliseconds by otPlatAlarmMilliGetNow. We used a 1ms
minimum delta to ensure that the absolute time would be in the next
millisecond but this could still fail. We therefore use a relative
timer in this case which on the cases where it fails should be 1ms
ahead of current time.
2019-08-14 12:32:50 -07:00
Jonathan Hui 0dde90edcb [fuzz] avoid tasklet execution if platform was reset (#4093) 2019-08-13 08:49:51 -07:00
Yakun Xu 80f982301c [dtls] remove unnecessary member variables (#4090) 2019-08-12 10:46:51 -07:00
Rongli Sun 72d7513b03 [tests] update inspect along with #3878 changes (#4088) 2019-08-12 09:08:55 -07:00
Abtin Keshavarzian f9f8d2c690 [key-manager] update ComputeKey to use BigEndian::WriteUnit32 (#4087) 2019-08-12 09:07:10 -07:00
Abtin Keshavarzian 7d42350693 [key-manager] add a common GenerateNonce used by both MAC and MLE (#4086) 2019-08-12 09:06:16 -07:00
Jonathan Hui c5be94a7dc [dtls] set mReceiveMessage to NULL when done processing (#4085) 2019-08-12 09:03:38 -07:00
Abtin Keshavarzian f73b6b9337 [mle] save network info on mle mode change (#4078)
This commit ensures to save the network info in non-volatile settings
when the MLE device mode is changed (`Mle::SetDevcieMode()`)
independent of whether the device is currently attached or not. This
helps address the situation where there is a single router/leader
device in network and user changes the MLE thread mode to make it a
sleepy (where due to device being the only node in the network it
would not attach). Then, later upon device reset (without the change
in this commit) the device would have started again as router/leader.
Note that network info is saved/updated in non-volatile memory after a
successful attach.
2019-08-12 09:03:04 -07:00
Abtin Keshavarzian 278315c6e5 [config] fix config check helper messages (#4067)
This commit updates helper error message in `core-config-check.h`
file and adds some of the missing changed config option. It also adds
a comment to indicate that error message is intended as a hint to
what the new configuration parameter name may be.
2019-08-09 08:30:20 -07:00
Yakun Xu 4143fb4a39 [posix-sim] implement UART flush (#4072) 2019-08-08 12:10:50 -07:00
Yakun Xu f740fda8d6 [test] support full log (#4071)
This is useful when more logs are enabled and the logs contain
"leader", "child", "router" or "leader".
2019-08-08 08:34:14 -07:00
Abtin Keshavarzian 5d09ce7124 [config] remove duplicate unused definitions and fix comments (#4069)
This commit removes the unused duplicate definition in `tmf.h` for
`OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH` (this is
defined in `config/mle.h`). Also updates the comment/documentation
for `DHCP6_SERVER_NUM_PREFIXES` and `JOINER_MAX_CANDIDATES`.
2019-08-08 08:32:33 -07:00
Abtin Keshavarzian 0508f19c09 [config] fix config option OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER (#4068)
This commit fixes the wrong name used in `npc_uart.cpp`. Note that
this config parameter is part of `configure.ac` definitions.
2019-08-08 08:32:05 -07:00
Abtin Keshavarzian 18cd02e6b1 [mac] update the log message for frame tx failure (#4059)
The new model handles the case where frame retries are not handled
by sub-mac layer (e.g., delegated to radio platform).

This helps improve the log message in posix-app model where the retx
is handled by the RCP and not on the host side.
2019-08-08 08:31:12 -07:00
Abtin Keshavarzian 700bb6b5a8 [radio] adding Radio::Callback class (#4045)
This commit adds a `Radio::Callback` class which provides all the
callbacks (as C++ methods) mirroring the radio platform layer
callbacks (including the diags related radio callbacks).
2019-08-08 08:29:38 -07:00
Abtin Keshavarzian 142d98c0ee [radio] add Radio class abstracting radio platform APIs (#4045)
This commit adds a a `Radio` class which provides all `otPlatRadio`
platform APIs (as C++ methods). All OT core modules use the new
`Radio` methods to interact with radio platform APIs.
2019-08-08 08:29:38 -07:00
Abtin Keshavarzian b1d92846c0 [radio] add radio folder to core (#4045)
This commit renames existing `phy` folder into `radio`. It also
renames some of the related files in this folder. It also moves
all default/weak `otPlatRadio` implementations to a common
`radio_platform_defaults.cpp` file.
2019-08-08 08:29:38 -07:00
Marven Gilhespie 6ebc517408 [efr32] fix assert triggered in otPlatRadioTransmit (#3768) (#4060)
* Removed assert if RAIL_StartTx() fails. It will report the error and continue

* Updated Makefile.am to fix missing header and prettified radio.c

* Added OPENTHREAD_CONFIG_NCP_UART_ENABLE to efr32mg12 config
2019-08-06 09:32:24 -07:00
Rafał Kuźnia 28a9620758 [ncp] set NCP instance pointer to NULL during pseudo reset (#4065)
This commit fixes the problem with initializing the NCP with
wpantund. The bug was apparent when the NCP image was built with the
FULL_LOGS switch set.

The reason for the bug was that after the pseudo reset the OpenThread
stack wrote logs to NCP's otPlatLog implementation that used the not
yet initialized NCP object. This put the mUartSendTask and
mUpdateChangedPropsTask to the TaskletScheduler linked list.

Later when the NCP itself was initialized, the mNext pointer in the
tasklets mUartSendTask and mUpdateChangedPropsTask was set to null,
causing all tasklets scheduled after the mUartSendTask to be lost. The
NCP reset status could not be in such case sent to the wpantund. The
wpantund then retried resetting the NCP, which repeated the process
until the wpantund gave up.
2019-08-06 09:16:08 -07:00
Yakun Xu c7a7d1e7f5 [posix] always set timestamp (#4066)
This sets frame rx timestamp regardless of promiscuous mode enabled or
not. This is useful for debugging time related issues.
2019-08-06 09:11:42 -07:00
Mirek 70a9046f79 [docs] fix diag README link (#4064) 2019-08-06 09:07:43 -07:00
Yakun Xu 116f9cbdbc [travis] generate size report (#4026)
This commit splits the jobs into 2 stages: lint, test.  In the lint
stage, generate size diff report and post into the pull request.
2019-08-06 09:05:54 -07:00
Abtin Keshavarzian 78f602df42 [data-poll-handler] update the logging of indirect tx failure (#4058)
This commit changes data poll handler to log an indirect tx failure
only when the tx attempt counter is increased (i.e., when there is a
no-ack error).
2019-08-05 11:10:31 -07:00
Zhanglong Xia 14875e1380 [posix] fix time sync issue (#4057)
#4015 missed setting the timestamp when TIME_SYNC is enabled.
2019-08-05 10:42:14 -07:00
Jonathan Hui f37c3256e7 [docs] remove AppVeyor from CONTRIBUTING.md (#4056) 2019-08-05 09:05:52 -07:00
Jonathan Hui b44fab7327 [travis] add GCC 9 to build matrix (#4055) 2019-08-05 09:05:23 -07:00
Zhanglong Xia a03d4ee9be [udp] update the returned value of API otUdpOpen() (#4054) 2019-08-05 09:03:23 -07:00
Jonathan Hui af573f5e72 [dataset] only master key is needed to attach (#4051) 2019-08-05 09:02:25 -07:00
Abtin Keshavarzian 2eab474025 [ncp] use OT public link API to get factory-assigned EUI64 (#4047)
This commit changes the get handler for `SPINEL_PROP_HWADDR` to
use the public OT link API `otLinkGetFactoryAssignedIeeeEui64`
instead of the platform API. It also adds implementation of
this API under `OPENTREAD_RADIO` mode (for RCP build).
2019-08-05 08:52:17 -07:00
Abtin Keshavarzian 939ac82bf2 [indirect-sender] add FrameContext class (#4005)
This commit adds a `FrameContext` type (containing all info that need
to be saved along with a prepared frame for indirect transmission) and
its support in `IndirectSender` and `DataPollHandler`. While the
`FrameContext` is defined by the `IndirectSender`, the lower-layer
`DataPollHandler` is expected to provide the buffer/object for it to
be stored (when the frame is prepared). This model allows different
implementations of `DataPollHandler` to adopt different strategies on
how to store the context.
2019-08-02 14:19:32 -07:00
Abtin Keshavarzian 6d07a3eb31 [radio-spinel] remove extra log on tx done failure (#4052)
This commit removes the extra logging of spinel error status on
tx done callback. The error will be logged from `LogIfFail()` at
the exit of the `HandleTransmitDone()`.
2019-08-02 08:39:14 -07:00
Yakun Xu 6c6aad2a01 [mac] define TxFrame and RxFrame types (#4040)
This commit defines RxFrame for receiving frames and TxFrame for
transmitting frames. The motivation is to prevent invalid uses of
Mac::Frame methods, because some of them are only available for rx
frames and some only for tx frames.
2019-08-01 15:28:19 -07:00
Yakun Xu 8782bf8b3e [config] set message buffer size based on CPU word length (#4049)
Message buffers store pointers which have different sizes on different
system. Setting message buffer size according to the CPU word length
so that message buffer size will be doubled on 64bit system compared
to that on 32bit system. As a result, the first message always have
some bytes left for small packets.
2019-08-01 10:32:05 -07:00
Abtin Keshavarzian 31ce3d45c8 [style] harmonize boolean checks (#4048)
This commit simplifies boolean checks containing `== false` to use the
`!` operator instead, and removes redundant `== true` checks. This
commit aims to harmonize the boolean checks across core modules.
2019-08-01 10:30:08 -07:00
Yakun Xu 74bfb58d2a [tests] add delay for test_diag (#4046)
This change seems to make the test_diag case stable. The root cause
may be that distcheck enables address sanitizer, which may cause the
program to respond slower.
2019-08-01 08:52:50 -07:00
Abtin Keshavarzian fee0468ca9 [diags] make Diags class be an InstanceLocator (#4044) 2019-08-01 08:35:37 -07:00
Matt Smith 1083dd0ccb [logging] replace tab char with 4 spaces (#4043) 2019-08-01 08:34:04 -07:00
Jonathan Hui 6adff12a7e [git] add *.flash to gitignore (#4042)
Also remove files accidentally checked in.
2019-07-31 17:58:42 -07:00
Abtin Keshavarzian 04896eadee [config] add checks for earlier config options (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 02da206f39 [config] remaining configure options (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 149640da49 [config] tmf (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 926b9e8661 [config] time sync (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 8d61b4b99e [config] sntp client (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 5e395ddf54 [config] platform (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 60f0412cf3 [config] parent search (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui df379636da [config] ncp (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 953c9db6b7 [config] mle (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 0baaf1afba [config] mac (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 14fc1318db [config] logging (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui abdf557c6b [config] link raw (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui a3b6d11851 [config] link quality (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 31ffd1645e [config] joiner (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 4a475d5673 [config] ip6 (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 297ab4742f [config] dns client (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui a608896cd3 [config] diag (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 0a14116b3d [config] dhcp6 server (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 0d6f2be1dc [config] dhcp6 client (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui f72f792874 [config] commissioner (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 6c8a9a8661 [config] coap (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 5ab52e50f6 [config] cli (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui aa82391db1 [config] child supervision (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 01ebc18f97 [config] channel monitor (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 1021946d6d [config] channel manager (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui f18497395a [config] border router (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 0ded98b011 [config] announce sender (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui d823575caf [config] dtls (#4020) 2019-07-31 14:16:30 -07:00
Jonathan Hui 512d23398e [config] move default configs to src/core/config (#4020) 2019-07-31 14:16:30 -07:00
Yakun Xu a5ed9ce573 [spinel] use 64bit timestamp for rx frames (#4037)
This commit changes the default timestamp of rx frames to be 64bit,
which is aimed to ensure the timestamp never wraps. This commit
changes the protocol of spinel.

NOTE: Changing spinel protocol is not allowed normally. However, since
the timestamp is only used by sniffer, an exception is made due to the
improved efficiency. Pyspinel is also updated accordingly.
2019-07-31 08:56:37 -07:00
Abtin Keshavarzian 0546a2f972 [mle] adding DeviceMode class (#4035)
This commit adds a `Mle::DeviceMode` class which is warpper over
a device mode bitmask (`uint8_t`) and provides the common helper
functions like `IsRxOnWhenIdle()`, `IsFullThreadDevice()`, etc.
2019-07-30 15:13:37 -07:00
Łukasz Duda 3d3315bf61 [thci] remove unused methods (#4034) 2019-07-29 22:53:09 -07:00
Yakun Xu d041699ad3 [radio] use a single variable for frame timestamp (#4015)
This commit replaces mSec and mUsec in otRadioFrame with a single
mTimestamp to record when the frame is received.

The timestamp MUST be the time when SFD was received when TIME_SYNC or
CSL (Thread 1.2) is enabled, otherwise, it is the time when rx was
done.

This change reduces memory required to represent a radio frame.
2019-07-29 22:52:37 -07:00
Łukasz Duda 4cb7d1fe77 [nrf528xx] do not override OPENTHREAD_CONFIG_LOG_OUTPUT from Makefile file (#4033) 2019-07-29 10:38:42 -07:00
Seth Rickard ec42022e53 [cc1352] limit DRBG to only use 128-bit AES keys (#4032)
The CC2650 only has hardware acceleration for 128-bit AES keys. The
CC1352 and CC2652 have hardware acceleration for 128- and 256-bit keys.
However, the current driver does not implement larger than 128-bit keys.
2019-07-29 09:44:18 -07:00
Jonathan Hui beac7ae438 [fuzz] add stub for otPlatUartFlush() (#4031) 2019-07-29 08:26:17 -07:00
Marven Gilhespie e0fdc20f47 [efr32] revert uart.c to commit 4c06b47c34 (#4030)
Fixes NCP often entering a uninitialized:fault state during reset.
Readded otSysEventSignalPending to efr32mg12 uart.c
2019-07-29 08:25:55 -07:00
Abtin Keshavarzian 66cd36b638 [mesh-forwarder] drop direct supervision message (#4029)
This commit changes `MeshForwarder` to drop a direct supervision
message. A direct supervision message is possible in the case where a
sleepy child switches its mode (becomes non-sleepy) while there is a
pending indirect supervision message in the send queue for it. The
message would be then converted to a direct tx. This commit also
removes the definitions/methods (e.g. `SendEmptyFrame()`) that were
being used for prepartion of supervision message which are no longer
needed.
2019-07-29 08:23:35 -07:00
Jonathan Hui ce18a1edaa [mle] remove unused member variables (#4027) 2019-07-29 08:22:18 -07:00
Jonathan Hui 97c935c870 [dtls] fix when SSL Server is enabled (#4024)
A call to `mbedtls_ssl_set_client_transport_id()` is necessary when using
the SSL Server module. This commit ensures a call to the aforementioned
function when using CoAP Secure with PSK cipher suite.
2019-07-29 08:21:52 -07:00
Mirek ec6057c524 [cli] make output of panid consistent with input (#4028) 2019-07-26 09:00:24 -07:00
Abtin Keshavarzian aec0e0b2a0 [data-poll-sender] add logic to select poll destination (#4023)
This commit changes the interaction of `Mac` and `DataPollSender` such
that the selection of a data poll destination MAC address is delegated
to `DataPollSender` (related code is moved into `DataPollSender` from
`Mac`).
2019-07-25 21:35:18 -07:00
Yakun Xu 425e4a3326 [posix-app] fix using GNU readline on macOS (#4014) 2019-07-24 10:12:42 -07:00
Stuart Longland 4bfdfa0132 [platform] add a UART flush operation (#4003)
This commit allows the CLI to flush its transmit buffer of pending
data so that it can resume writing to the buffer.

This allows for reducing the size of the transmit buffer used for the
CLI whilst still retaining the ability to transmit long blocks of text
(which is required by the Thread certification tests) without locking
up the use of that memory on constrained devices like CC2538.
2019-07-23 21:01:16 -07:00
Łukasz Duda e583eef413 [nrf528xx] use nrfx_spis driver (#4016)
Signed-off-by: Duda, Lukasz <Lukasz.Duda@nordicsemi.no>
2019-07-23 13:50:29 -07:00
huamenggg a307039927 [posix-app] fix missing sentinel in execl() (#4007)
This commit fixes a build error on OpenWRT.

Error: missing sentinel in function execl.
2019-07-23 12:49:04 -07:00
Jonathan Hui bcbe8e2179 [style] remove extra ';' (#4017) 2019-07-23 09:45:18 -07:00
Jonathan Hui e87bc42184 [diag] move factory diags into core (#4010)
- Simplifies make files by not having to deal with separate library.
- Combine factory diags source into single source file.
2019-07-23 08:47:16 -07:00
Zhanglong Xia a5124493d9 [platform] add platform check for core configuration option (#4008) 2019-07-23 08:45:58 -07:00
Zhanglong Xia 5d2e8e1e57 [posix-app] add platform log to record when program exits (#3989) 2019-07-22 18:51:07 -07:00
Abtin Keshavarzian be64623b36 [toranj] update child mode change test for msg direct/indirect conversion (#4001)
This commit updates `test-027-child-mode-change` to verify the
behavior of a parent node related to conversion of queued messages
(indirect to direct tx) upon the child's mode change from sleepy to
non-sleepy).
2019-07-22 09:45:33 -07:00
Abtin Keshavarzian e9e900a5dc [indirect-sender] convert queued child messages when mode changes (#4001)
This commit ensures all queued messages for a child are accordingly
converted (indirect to direct transmission) when a child switches its
mode from sleepy to non-sleepy.
2019-07-22 09:45:33 -07:00
Jonathan Hui 3a6cefd48c [meshcop] avoid clearing non-trival type in DelayedJoinEntHeader (#4012) 2019-07-22 09:38:47 -07:00
Jonathan Hui a211901f62 [network-data] compare TLV length in Leader::IsStableUpdated() (#4011) 2019-07-22 09:38:30 -07:00
Paweł Wańczyk db8c4c8339 [diag] diagnostic module improvements (#3969)
Added diagnostic statistic clearing.
Improved tx power setting.
Provide RSSI of the last received packet.
2019-07-18 21:24:58 -07:00
Abtin Keshavarzian 050cc07206 [toranj] update test-002 to verify immediate command after a reset (#4006)
This commit updates toranj `test-002` to verify behavior of `wpantund`
when a command is issued immediately after a `reset`.
2019-07-18 21:24:05 -07:00
Marven Gilhespie 11e18b858b [efr32] Removed hal-config-board.h from sleepy-demo, moved needed defines into brdxxxx/hal-config.h (#4004)
Fixes build error on efr32mg12/brd4304a that resulted in a conflicting
define of BSP_LED_POLARITY.  Removed hal-config-board.h from sleepy
demo and moved some definitions into each hal-config.h in order to
build.
2019-07-17 08:50:42 -07:00
Abtin Keshavarzian 73c27837cf [indirect-sender] log when preparing a message for indirect tx (#4002) 2019-07-17 08:48:30 -07:00
Piotr Szkotak 8a640a2cfa [travis] extend ncp transport coverage (#4000)
This commit makes the travis run scan-build twice, for the UART and
the SPI NCP configurations respectively.
2019-07-17 08:48:04 -07:00
Marven Gilhespie 6d7098c0a8 [efr32] add otSysEventSignalPending calls and weak function to efr32mg12 (#3999)
Initialization of NVIC and priorities.
2019-07-17 08:46:13 -07:00
Yakun Xu 06a914da0a [build] add flag for big endian (#3996) 2019-07-17 08:43:57 -07:00
rongli 59fcb1c9ad [toranj] add partition id set/get to test-001-get-set (#3998) 2019-07-16 13:56:53 -07:00
Yakun Xu 901ea13cdb [android] always enable mac filter (#3997) 2019-07-16 10:45:16 -07:00
Jonathan Hui cc66f47972 [emsk] remove unsupported platform (#3995) 2019-07-16 09:04:55 -07:00
Jonathan Hui 6393901e52 [spi-hdlc-adapter] add cast to unsigned int on call to usleep (#3994) 2019-07-16 09:04:34 -07:00
Yakun Xu e80f46a993 [posix-sim] use multicast to simulate radio (#3993)
This commit uses multicast to simulate radio transmissions. This
avoids sending a frame multiple times and avoids duplicated packets in
captures.

This implementation uses two separate sockets for tx and rx. The
current implementation of thread-cert requires the sniffer to report
the sender of each packet. This issue can be addressed by stateful
tracking state of each node, but left for future work.
2019-07-16 09:03:42 -07:00
Li Cao b289c94122 [tests] fix mac header ie parsing problem (#3976) 2019-07-16 08:47:38 -07:00
Abtin Keshavarzian d4ce582f95 [data-poll-handler] adding DataPollHandler class (#3952)
This commit adds a new class `DataPollHandler` which sits between
`Mac` layer and `IndirectSender`. It interfaces to `Mac` to handle any
received data poll and perform indirect frame transmission including
the re-transmission logic of frames (per poll). All state info (per
child) for handling of indirect frame retransmission is now defined
and managed by the `DataPollHanlder` class itself. This commit updates
the `IndiretSender` to interface with the `DataPollHandler` class and
handle preparation of frames from `Message` for indirect transmission.
2019-07-16 08:38:29 -07:00
Abtin Keshavarzian a222a82e04 [mesh-forwarder] add PrepareDataFrame() (#3952)
This commit refactors and updates the existing code to add a generic
method `MeshForwarder::PrepareDataFrame()`. This method constructs a
MAC data from from a given IPv6 message at the offset set in the
message. This method enables link security when message is MLE type
and requires fragmentation.
2019-07-16 08:38:29 -07:00
Abtin Keshavarzian 7c548bba23 [mac] add new operation for indirect data frame transmission (#3952)
This commit adds a new operation for indirect data frame transmission
in `Mac` class (only available on FTD build). The indirect tx request
is handled before a direct tx request. This commit also changes how
the number of retries and CMSA attempts (for a frame) are determined
`Mac` class itself now sets these according to request type.
2019-07-16 08:38:29 -07:00
Abtin Keshavarzian 54e7a9b7af [indirect-sender] define ChildInfo for child indirect tx related info (#3952)
This commit defines `IndirectSender::ChildInfo` class in child sender
module which contains all the info needed to store (per child) for
handling of indirect transmissions to the child. The `Child` class
inherits from the new class. This helps keep the indirect tx info in
the same file.
2019-07-16 08:38:29 -07:00
Abtin Keshavarzian f56e12d205 [indirect-sender] adding new class IndirectSender (#3952)
This commit adds a new module/class `IndirectSender` for handling
of the indirect transmission to sleepy children. The commit just
moves the existing code form `MeshForwarder` into the new class.
2019-07-16 08:38:29 -07:00
Yakun Xu 6db6ad8045 [dtls] fix connection from host interface (#3992) 2019-07-15 08:53:27 -07:00
huamenggg 9d57e4b9b9 [posix-app] add HOST flag for cross compiling (#3991)
This commit add 'HOST' to provide the option for changing compile
target host for OpenWRT.
2019-07-15 08:52:18 -07:00
Yakun Xu 9b51c2ed1d [posix] merge virtual time and real time radio (#3974) 2019-07-12 11:27:20 -07:00
Abtin Keshavarzian 1b8dc87586 [mac] change the sub-mac callback model (#3987)
This commit changes the sub-mac callback model to simplify it such
that `SubMac::Callback` is itself an `InstanceLocator` and directly
calls into the correct next layers (`Mac` or `LinkRaw`). This model
relaxes the need for the other classes to sub-class the `Callback`
and will have `SubMac` itself define a `mCallbacks` instance (which
is an empty class) instead of tracking a reference to a callback
object.
2019-07-12 11:14:19 -07:00
Yakun Xu ae014b3f6d [posix] close files on exec (#3977)
This commit adds the *_CLOEXEC flags when opening files. This ensures
files are closed when spawning new processes.

* use LOG_DAEMON as syslog facility
* remove setenv() when forkpty
2019-07-12 09:40:06 -07:00
Abtin Keshavarzian cac09b7a70 [toranj] fix typo in method name "prepare_listener" (#3984) 2019-07-12 00:57:04 -04:00
Łukasz Duda 557d816e2c [nrf52840] update documentation and fix broken link (#3986)
Signed-off-by: Duda, Lukasz <Lukasz.Duda@nordicsemi.no>
2019-07-11 11:47:34 -04:00
Jonathan Hui f924adcb60 [style] update python style to conform to PEP 8 (#3951)
With the exception of line length set to 119 vs. 79.

Add tests/ and tools/ to py-pretty-check.
2019-07-11 11:45:55 -04:00
Yakun Xu a938ee2845 [cli] fix some links in src/cli/README.md (#3980) 2019-07-10 06:28:06 -07:00
Zhanglong Xia c1a64613d6 [settings] remove useless functions (#3971) 2019-07-10 06:13:49 -07:00
Zhanglong Xia 97708013c8 [settings] reformat doxygen (#3970) 2019-07-10 06:10:39 -07:00
Zhanglong Xia 6468973718 [spi-hdlc-adapter] add delay after reset the RCP chip (#3968) 2019-07-10 06:07:10 -07:00
Ciaran Woodward 6a2c3ba10c [coap] Improve behaviour of CoAP multicast requests & responses (#3967)
This commit prevents the CoAP stack from sending automatic 'Not
Found' responses to multicast CoAP requests, as suggested in RFC7252
8.2:

   When a server is aware that a request arrived via multicast, the
   server MAY always ignore the request, in particular if it doesn't
   have anything useful to respond (e.g., if it only has an empty
   payload or an error response).

This commit also allows CoAP requests that are sent to multicast
addresses to receive multiple responses, which will all be processed
by the same handler callback (For instance, a multicast GET to
discover network resources).
2019-07-10 06:06:21 -07:00
Jonathan Hui 141437dd28 [codecov] enable coverage reporting on PRs (#3965) 2019-07-09 20:06:46 -07:00
Abtin Keshavarzian d92733661c [posix-app] simplify makefiles (#3975)
* [cli] ensure legacy callback APIs are defined as `OT_TOOL_WEAK`

* [posix-app] simplify the makefile (link in ncp lib).

This commit simplifies the posix-app makefiles by removing the
`inc_<module>` source files (which included certain modules from
the `ncp` folder). Instead the library `libopenthread-ncp-ftd.a`
is included when linking thethe final posix-app executables
`ot-ncp`,  `ot-cli` and/or, `o-daemon`.

* [posix-app] ensure header files from ncp folder have "ncp/" prefix

This commit changes the posix-app platform makefile such that
the header files from `src/ncp` folder require "ncp/" prefix.
2019-07-09 13:24:41 -07:00
Rongli Sun 21221d9903 [build] rename CERT_LOG to REFERENCE_DEVICE (#3960)
Also, remove from configure.ac.
2019-07-09 09:09:59 -07:00
Zhanglong Xia 668256290d [spi-hdlc-adapter] add syslog to record signal (#3966) 2019-07-09 04:38:23 -07:00
Yakun Xu d0285164a0 [cli] remove otPtr introduced by windows platform (#3973) 2019-07-09 04:36:08 -07:00
Zhanglong Xia 67993c6d58 [docs] fix typo in file README_COAP.md (#3972) 2019-07-09 04:34:50 -07:00
Abtin Keshavarzian f0e9ab2a9f [andriod] update makefile to include api/random_noncrypto_api.cpp (#3963) 2019-07-09 04:32:10 -07:00
Jonathan Hui 968f15f540 [logs] compile Mac::Frame::ToInfoString at NOTE log level (#3962)
This fixes a linker error when buiding with OT_LOG_LEVEL_NOTE.

MeshForwarder depends on Mac::Frame::ToInfoString at the NOTE level.
2019-07-09 04:31:28 -07:00
Zhanglong Xia 8de5fbeae7 [posix-app] close the settings file when reset (#3958)
Currently, the Setting file won't be closed after ot-ncp is reset.
Once ot-ncp receives a RESET command from wpantund, it will reopen
the Setting file and create a new file Id.

This commit closes the Setting file when ot-ncp is reset.
2019-07-08 21:21:14 -07:00
Christian Stauffer b983974aec [cli] delete redundant and unnecessary includes (#3959) 2019-07-03 10:54:50 -07:00
Abtin Keshavarzian be994b66cf [random-manager] move entropy and rng related code into RandomManager (#3953)
This commit moves all the related code for managing entropy and crypto
and non-crypto random number generation into the `RandomManager`
class. This helps simplify the initialization process by having all
modules use a shared common init counter (`sInitCount`). This commit
also ensures that the shared instance of the non-crypto pseudo random
number generator is seeded only once.
2019-07-03 10:54:17 -07:00
Rongli Sun 0d75bbe3fa [cert] support partition id configuration for ncp device (#3955) 2019-07-02 19:27:09 -07:00
Jonathan Hui 60b01a8a4b [vagrant] remove vagrant file (#3954) 2019-07-02 18:49:27 +02:00
Marven Gilhespie 0bb0b7424d [efr32] add mg21 support and changes to mg12 radio inteface code (#3922)
* renamed efr32 in two for mg12 and mg21 and radio changes for mg12

Change to radio interface code, check the txBusy flag before
attempting to transmit a packet Cleaner auto state transition code and
safer event handling Use HAL_PA_VOLTAGE in all hal-config.h files

* uart flow control mode is configured from board /hal-config.h

Allows a different flow control mode for each EFR32 board as
necessary.  (hw flow control is not presently implemented on
Thunderboard Sense so HAL_USART_FLOW_CONTROL_NONE mode should be used
for BRD4166A, other boards use HAL_USART_FLOW_CONTROL_HWUART)
2019-07-02 18:43:28 +02:00
Jonathan Hui af46ffa53b [coverage] exclude logging code from coverage report (#3947) 2019-07-02 00:18:02 +02:00
Martin Turon ce26bffb50 [mac] change frame length type from uint8_t to uint16_t (#3939)
This adds support for MAC frames greater than 255 bytes in preparation
for other link layers that support larger frames.
2019-06-28 00:26:17 -07:00
Yakun Xu c826edc0c4 [posix-app] enhance RCP failure info (#3950)
By default, posix-app disables platform region logs. Even when
platform logs are enabled, logs	are sent to syslog without printing to
stderr.

This commit prints error information to	stderr on exit, providing the
user more direct information about failures. This commit also
eliminates the "wait no child process" error message.
2019-06-28 00:22:23 -07:00
Parker Evans 3fded34be1 [commissioner] add error checking to GetLeaderAloc and SendPetition in Start (#3949)
Adding the SendPetition error handling in Start and moving it before
updating the state fixes the potential issue of locking up the
commissioner in the OT_COMMISSIONER_STATE_PETITION state without
having actually sent the petition.
2019-06-27 00:06:36 -07:00
Jonathan Hui 016b1b1523 [address-resolver] fix TLV length in response messages (#3945) 2019-06-26 03:43:41 -07:00
Jonathan Hui 03fac0ff48 [message] adjust offset when cloning a message subset (#3944) 2019-06-26 03:42:59 -07:00
Jonathan Hui a6ae39893b [travis] set default build env to xenial (#3943) 2019-06-26 03:42:41 -07:00
Jonathan Hui 2142b0008d [scan-build] resolve warnings from scan-build-7 (#3943)
Resolve warnings when using clang static analyzer v7.
2019-06-26 03:42:41 -07:00
Yakun Xu e6eaf5c80b [posix-sim] enhance microsecond alarm implementation (#3942)
This commit enhances the microsecond timer implementation with POSIX
timer API. This only enhances simulation on Linux because the API is
not supported on macOS.

The call to timer_settime() schedules a microsecond precision alarm.
When the alarm fires, the process is signalled with
OPENTHREAD_CONFIG_MICRO_TIMER_SIGNAL. The signal handler does nothing,
but the process will resume and the existing micro timer process can
be performed on time.
2019-06-26 00:26:32 -07:00
Abtin Keshavarzian ce8f1172a8 [mac] simplify how HandleReceivedFrame() passes frame to next layer (#3941) 2019-06-25 00:23:03 -07:00
Abtin Keshavarzian adecc05755 [mesh-forwarder] clear children's indirect msg and src match table on stop (#3933)
This commit ensures to clear the indirect message pointer on all
children and reset the indirect message count (which in turn clear the
source match table) from `MeshForwarder::Stop()`. This addresses the
issue where on an `Stop()`/`Start()` call the source match table can
become out of sync with the send queue and/or a child may hold on to
an already freed `Message`.
2019-06-21 15:41:26 -07:00
Jeff Bumgardner 44596e2299 [docs] add Samsung to supporters and image cleanup (#3940) 2019-06-21 12:25:49 -07:00
Jonathan Hui 8224b3c49f [mle] add field-specific length methods to Challenge/Response TLVs (#3937) 2019-06-21 08:34:52 -07:00
Rongli Sun ea9a6d2b14 [network-diagnostic] specify link-local source for link-local destination (#3935)
In #3284, the source for network diagnostic is explicitly specified as RLOC.
However when link-local address is the destination, link-local source is
preferred.
2019-06-20 22:19:40 -07:00
Rongli Sun 7e28a2317a [coap] fix payload marker removal and add payload marker check (#3936) 2019-06-20 22:08:24 -07:00
Abtin Keshavarzian f11ff54775 [data-poll-sender] rename DataPollManager as DataPollSender (#3932)
This commit renames the `DataPollManager` to `DataPollSender` and
also moves the files in `src/core/mac` folder.
2019-06-20 12:27:46 -07:00
Jonathan Hui 8df0b5f421 [docs] update link to GNU Arm Embedded Toolchain (#3931) 2019-06-20 09:38:46 -07:00
Jonathan Hui d1ded876f9 [meshcop] add MeshLocalPrefixTlv::GetMeshLocalPrefixLength() (#3930) 2019-06-20 09:38:25 -07:00
Li Cao 0a084bbb9a [tests] change string concatenation format in python scripts (#3929) 2019-06-20 09:35:41 -07:00
Jonathan Hui 896ac0ab69 [examples] add headers to pretty check (#3927) 2019-06-20 09:35:10 -07:00
Jonathan Hui b4c53e6bda [netif] remove virtual methods (#3925) 2019-06-20 09:30:56 -07:00
Jonathan Hui 1631d23a13 [netif] remove interface id specification from interfaces (#3925) 2019-06-20 09:30:56 -07:00
Jonathan Hui df16da30f8 [netif] remove support for multiple netif instances (#3925) 2019-06-20 09:30:56 -07:00
Jonathan Hui 1b37f64ac3 [mle] remove unused MleRouter::RemoveNeighbor method (#3926) 2019-06-19 10:28:44 -07:00
Jonathan Hui b694b00951 [tlvs] allow longer length to support forward compatibility (#3919) 2019-06-18 11:49:05 -07:00
Abtin Keshavarzian 67f159c5e3 [data-poll-manager] remove code handling NO_BUFS error (#3918)
This commit remove the logic in `DataPollManager` related to handling
the `NO_BUFS` error case when sending a data poll. This logic is no
longer needed since the data poll tx logic is now handled by `Mac`
layer directly and there is no need to allocate/use a `Message` instance
for data poll (which could lead to `NO_BUFs` error situation).
2019-06-18 11:48:44 -07:00
Abtin Keshavarzian 936d4efe93 [mac] move data poll tx into Mac and DataPollManager (#3915)
This commit moves the implementation of data poll transmission
related logic into `Mac` and `DataPollManagr` from `MeshForwarder`.
2019-06-18 09:17:25 -07:00
Jeff Bumgardner 8a039efcf8 [docs] add SiLabs to list of supporters (#3923) 2019-06-17 13:07:15 -07:00
Rongli Sun 73ffd2a9dc [thci] bug fixes and clean up the code style (#3817)
This commit squashes the approved updates, mainly include
1) bug fix or enhancement
   - make pollperiod take effect
   - fix the issue in finding the address of the specific address
     (case-sensitive issue introduced in #3639)
   - make `__sendCommand` more robust for possible extra serial output

3) Update along with master code and other minor updates
   - the command used to find specific address (#3856)
   - the IP6Prefix string len (from 20 to 19)
   - correct typos

2) Code Style
   - use single quotes for code
   - update to use `print ()` and format `%`
   - format via with `black` tool locally
     `python3 -m black -l 79 -S tools/harness-thci -t py27`
   - add travis python check example for THCI with `flake8` tool

notes: require OT code with #3856 (get specific address) and #3862 (`joiner id`)
2019-06-17 09:03:55 -07:00
Jonathan Hui 932cd78f04 [style] apply missing const declarations (#3921) 2019-06-14 12:45:39 -07:00
Jonathan Hui 6dfd716da1 [auto-start] remove auto-start feature (#3920) 2019-06-14 12:40:30 -07:00
Abtin Keshavarzian b4c56c447e [mac] inline shorter methods / rename frame preparing methods (#3914) 2019-06-14 09:33:40 -07:00
Abtin Keshavarzian 6f290088f2 [mesh-forwarder] enhance data poll log message (#3913) 2019-06-14 09:32:12 -07:00
Łukasz Duda 8c0c32548d [doc] remove unused definitions (#3917) 2019-06-13 09:07:38 -07:00
Łukasz Duda d0c7ff2bb4 [nrf528xx] update nRF IEEE Radio Driver to version 1.4.0 (#3916)
Signed-off-by: Duda, Lukasz <Lukasz.Duda@nordicsemi.no>
2019-06-13 08:35:28 -07:00
Jonathan Hui caf268c45e [route-table] remove unused Ip6::Routes (#3911) 2019-06-13 08:32:05 -07:00
Abtin Keshavarzian dbc04a8a05 [dataset] choose a preferred channel when forming new dataset (#3910)
This commit changes the `ActiveDataset::CreateNewNetwork()` to select
a random channel from the preferred channel mask if it is not empty,
otherwise a random channel from the supported mask is picked.
2019-06-12 08:45:29 -07:00
Abtin Keshavarzian d614d4a080 [mac] rename methods requesting frame transmission (#3909) 2019-06-12 08:36:54 -07:00
Jonathan Hui 485ab9ed38 [coap] add checks for OT_ERROR_NO_BUFS (#3904)
- Update Coap::Message::SetToken() to return error.
- Update Coap::Message::SetDefaultResponseHeader() to return error.
- Add error checking around calls to the above.
2019-06-11 10:27:54 -07:00
Abtin Keshavarzian 65f1ac44db [spinel] remove unused definitions (#3890)
This commit removes unused macro definitions in spinel header file.
2019-06-11 10:27:38 -07:00
Abtin Keshavarzian 9d7fc71917 [spinel] validate decoded/unpacked UTF8 string (#3889)
This commit adds `spinel_validate_utf8()` function which verifies
whether a given (null terminated) sequence of bytes (string) follows
the UTF8 encoding format. This function is then used to check any
decoded/unpacked spinel UTF8 type. This commit also adds test-cases
in spinel to check the behavior of the new function with a set of
UTF8 valid and invalid strings.
2019-06-11 10:27:17 -07:00
Jonathan Hui 738c1b3574 [tests] remove windows-specific test support (#3907) 2019-06-10 08:45:14 -07:00
Jonathan Hui 46bad7bee6 [cli] remove "s_" prefix from static methods (#3905) 2019-06-10 08:44:48 -07:00
Abtin Keshavarzian e95789e819 [doc] remove spinel-protocol-src documentation files (#3903)
This commit removes the files under `doc/spinel-protocol-src`
since all the related docs are moved to `spinel.h` or other related
header files.
2019-06-07 12:09:57 -07:00
Abtin Keshavarzian a508e5ebe5 [spinel] add framing and data type docs in header file (#3903)
This commit also adds the SPI framing protocol documentation in
`ncp_spi.h`.
2019-06-07 12:09:57 -07:00
Abtin Keshavarzian 0ffb4ff1d4 [toolchain] remove the unused definition UINT32_MAX 2019-06-07 11:21:21 -07:00
Abtin Keshavarzian 2a5403d94a [sntp-clinet] simplify uint64 constants 2019-06-07 11:21:21 -07:00
Abtin Keshavarzian d52aa05b54 [ncp] spinel prop to get a new dataset (use when forming new network) (#3902)
This commit adds a new property `SPINEL_PROP_THREAD_NEW_DATASET` in
spinel to create a new Operational Dataset to use when forming a new
network. This property maps to `otDatasetCreateNewNetwork()`
2019-06-07 09:08:33 -07:00
wgtdkp 49150943c1 [dtls] invoke callback after DTLS disconnect timeout (#3897) 2019-06-06 11:57:09 -07:00
Kamil Sroka c14cc60962 [windows] remove unsupported platform (#3878) 2019-06-06 11:55:18 -07:00
Kamil Sroka e482edb0f1 [mbedtls] add threading errors translation (#3900) 2019-06-05 11:02:49 -07:00
Yakun Xu 73f17031a1 [random] assert aMax is bigger than aMin (#3894) 2019-06-05 10:14:09 -07:00
Abtin Keshavarzian 7c10be51fa [message] remove the AllMessageQueue in MessagePool (#3893)
This commit removes the all-messages queue from `MessagePool`. This
simplifies the `Message` header `MessageInfo` and allow a message
to be inserted into one linked list.
2019-06-05 10:13:40 -07:00
Kamil Sroka 8c08fd8815 [build] rename ncp_radio to rcp (#3580) 2019-06-05 10:12:50 -07:00
Seth Rickard b9d20b590e [cc13x2,cc26x2] update CC13X2 CC26X2 driverlib (#3888) 2019-06-04 15:04:46 -07:00
Li Cao f51598ea6c [android_mk] add random_crypto_api.cpp to Android.mk (#3895) 2019-06-04 07:31:33 -07:00
Zhanglong Xia 782ce52a6e [ncp] update static checking for diag output buffer size (#3891) 2019-06-04 07:29:18 -07:00
rongli bc8e3e31a9 [dhcp] fix solicit request issue (#3887) 2019-06-03 08:26:28 -07:00
Joseph Newman 5d6ed3dd71 [settings] add option to store settings in volatile storage (#3811) 2019-06-03 08:24:49 -07:00
Abtin Keshavarzian 2266b5eb27 [instance] update order of member variables (#3886)
This commit updates order of member variable definitions in the
Instance class to ensure that objects that may be used by others are
initialized first. In particular, Tasklet and Timer Schedulers, and
RandomManager are initialized first. On FTD/MTD, this is followed by
Notifier, Settings, and MessagePool objects.
2019-05-31 09:15:58 -07:00
Joseph Newman f5dcae4093 [time-sync] reset sequence upon joining a new partition (#3884)
- reset sequence upon joining a new partition
- ensure leader is always authoritative
2019-05-31 09:14:08 -07:00
Łukasz Duda 6d1d7b2404 [cli] count failed ping try (#3882) 2019-05-31 09:10:40 -07:00
Abtin Keshavarzian df0a5787c4 [hdlc] update MultiFrameBuffer to allow saved frames to be re-read (#3881)
This commit updates the `MultiFrameBuffer` class implementation mainly
how the saved frames in buffer are read. The new code allows a user to
re-read the frames again. This change makes the implementation simpler
and more flexible. The corresponding unit test is also updated to
verify new behavior.
2019-05-31 09:09:42 -07:00
Łukasz Duda 99937016c0 [cli] extend ipaddr command for selective address printing (#3856) 2019-05-29 13:46:56 -07:00
Jonathan Hui 787184d4bb [docs] enhance commissioning docs for CLI (#3862)
- Separate into separate README files.
- Add quick start guide.
2019-05-28 18:25:50 -07:00
Jonathan Hui 204d0a91a3 [commissioner] add callback for joiner events (#3862) 2019-05-28 18:25:50 -07:00
Jonathan Hui 1abf57dd2f [commissioner] add callback for state changes (#3862) 2019-05-28 18:25:50 -07:00
Jonathan Hui 68beda5b07 [cli] move commissioner to separate source files (#3862) 2019-05-28 18:25:50 -07:00
Jonathan Hui 9cd11a2761 [cli] move joiner to separate source files (#3862) 2019-05-28 18:25:50 -07:00
Yakun Xu 6b4f8a8829 [mac] keep the second energy scan sample (#3871)
This commit fixes an issue where the second sample is skipped
because the timer had not expired yet.
2019-05-28 11:50:02 -07:00
Kamil Sroka 754da79286 [doc] define missing groups (#3876) 2019-05-28 10:19:36 -07:00
Yakun Xu 2695dc982f [cli] fix coap secure typo (#3873) 2019-05-28 10:15:52 -07:00
Abtin Keshavarzian 9df0bac4d9 [mle] skip saving NetworkInfo before first device attach (#3870)
This commit changes the `Mle::Store()` behavior such that if a device
is not attached and there is no previously saved `NetworkInfo`
(indicating that the device has never been attached before) we skip
saving/updating the `NetworkInfo`. Note that on a device reset the
MLE/MAC frame counters (which are part of `NetworkInfo`) would reset
but device would also start with a new randomly generated extended
address (so the security nonces would not be repeated).
2019-05-28 10:15:20 -07:00
Kamil Sroka ec3d8fbf22 [cc2538] fix entropy.c (#3861) 2019-05-28 10:14:04 -07:00
Yakun Xu df62add5a2 [cc2538] fix radio disabled for entropy get (#3872)
Restore RFCORE_XREG_FRMCTRL0 after generating random values.
2019-05-28 10:13:33 -07:00
Jeff Bumgardner fb11d96e61 [docs] update logo for new branding (#3869) 2019-05-24 19:10:26 -07:00
Abtin Keshavarzian 4aca025685 [toranj] update test-032 to cover addr reg after parent reset (#3829) 2019-05-24 15:19:20 -07:00
Abtin Keshavarzian b5d86fa319 [mle] only include mesh-local address in Child Update Response (#3829)
This commit changes preparation of "Child Update Response" (on a
child) such that only the mesh-local address is included in Address
Registration TLV. If the child has more addresses to register it
follows up with its own "Child Update Request".
2019-05-24 15:19:20 -07:00
Abtin Keshavarzian d7c0e9e716 [commissioner] add provisioning URL member variable (#3863)
This commit moves the definition of Provisioning URL TLV member
variable to `Commissioner` class (from `Dtls` class).
2019-05-24 11:31:15 -07:00
Jonathan Hui e458ef8f5f [nlbuild-autotools] update to 1.6.11 (#3868) 2019-05-24 11:24:30 -07:00
Jonathan Hui c87b283453 Squashed 'third_party/nlbuild-autotools/repo/' changes from d4c1c470..6b6a11dc
6b6a11dc Changed the bootstrap shebang from sh to bash to address a bashism that arrived at 1.6.10.
e97e9053 Merge pull request #22 from nestlabs/feature/improve-bootstrap-diagnostics
e367ac5d Added additional up-front checks to the bootstrap script to ensure the required executables are available. On failure to find those executables, offer users actionable steps to resolve the error.
299a9e4e Added additional up-front checks to ensure the required executables are available. On failure to find those executables, offer users actionable steps to resolve the error.
3c6f52e3 Fixed spaces / tab issue.
806f45ec Merge pull request #21 from nestlabs/bug/do-not-use-default-goal-in-headers
4f0cbeb1 Now that both automake and pure make headers and footers are co-mingled, address an issues in which the .DEFAULT_GOAL specifications in the repos.mak footer were conflicting with makefiles that wanted a different default goal by moving those .DEFAULT_GOAL specifications to Makefile-bootstrap.
d5901db8 Merge pull request #20 from nestlabs/feature/downrev-m4
f589293b Added content for and updated default version to 1.6.8.
6edebaaa Rebased several automake header macros implementations on their pure make equivalents.
a64a84c5 Reworked how verbose progress is handled to simplify specification of progress macros.
13b17fcb Leverage both automake and pure make headers and footers by including the latter in the former.
a50c3fe6 Downgraded m4 from 1.4.17 to 1.4.5 since 1.4.5 seems to be the last version of m4 that does not abort on invocation in the m4 *rintf and friends compatibility and portability library.
987a35b7 Merge pull request #19 from nestlabs/bug/fix-nl-filtered-canonical
690d12e0 * Addressed issues with NL_FILTERED_CANONICAL in which the desired   content to be filtered was not filtering correctly and in which   the desired filtered canonical variables were not emitted in   makefiles.
c141c281 Addressed an issue with _NL_FILTERED_CANONICAL in which the desired filtered canonical variables were not emitted in makefiles.
1a22c8f0 Addressed an issue with _NL_FILTERED_CANONICAL in which the desired content to be filtered was not filtering correctly.

git-subtree-dir: third_party/nlbuild-autotools/repo
git-subtree-split: 6b6a11dc98c6cc1f2faf2e729d0971704a5b5f28
2019-05-23 21:00:46 +00:00
Jonathan Hui c566e458c4 [nlbuild-autotools] update to 'https://github.com:nestlabs/nlbuild-autotools' tag '1.6.11'. 2019-05-23 21:00:46 +00:00
Kamil Sroka 2279ef610e [nrf52840] fix included headers in aes_alt.h (#3860) 2019-05-23 09:19:19 -07:00
wgtdkp 98ed5f16d7 [meshcop] fix bug of cipher suites check (#3858) 2019-05-23 09:19:03 -07:00
Yakun Xu 50949cbad9 [channel-manager] fix interval units (#3857) 2019-05-22 21:28:39 -07:00
Łukasz Duda eb46303ff8 [cli] clean up IPv6 address printing (#3855) 2019-05-22 10:59:04 -07:00
Łukasz Duda 9e7162253c [api] expose API to obtain RLOC (#3854) 2019-05-22 10:57:58 -07:00
Jonathan Hui bcfa791912 [mpl] add extra validation when removing MPL Option (#3851) 2019-05-22 10:57:04 -07:00
Duda, Lukasz 8d462f316e [cert] add additional validation for Cert_6_1_06 (#3853)
Also fix link quality configuration.
2019-05-22 10:56:19 -07:00
Duda, Lukasz 7310a34646 [cert] add additional validation for Router_5_1_11 test (#3853) 2019-05-22 10:56:19 -07:00
Jonathan Hui 26550d53c6 [mle] fix bug in MLE attach behavior (#3850)
Bug was introdcued in 5a7faa5.

A device performing MLE attach first sends an MLE Parent Request looking
for routers. If no MLE Parent Response is received from a neighboring router
where the link quality is 3 in both directions, the device shall send a
second MLE Parent Request that includes both routers and REEDs.

This commit adds the bi-directional link quality check to determine whether
a second MLE Parent Request should be sent.
2019-05-22 08:37:59 -07:00
Abtin Keshavarzian a9e63fe85d [toranj] add test for ML prefix change during attach (#3844) 2019-05-21 21:36:23 -07:00
Abtin Keshavarzian ddda77cd85 [ncp] emit link-local and mesh-local addresses before full table (#3844)
This commit changes the emitted properties from NCP such that the
mesh-local address (and prefix) are emitted before the entire IP
address table. This ensures that a host driver is aware of the
mesh-local prefix when it receives the full address table and can
correctly filter RLOC addresses (if desired).
2019-05-21 21:36:23 -07:00
Abtin Keshavarzian a1b2d354b1 [ncp] emit router entry addition/removal from neighbor table (#3838)
This commit updates `NcpBase` to emit `VALUE_INSERTED/REMOVED` spinel
message to host for `PROP_NEIGHBOR_TABLE` when a router neighbor entry
is added or removed.
2019-05-21 21:35:39 -07:00
Abtin Keshavarzian c0bc29197a [mle-router] signal child/router entry being added or removed (#3838)
This commit updates the neighbor table callback to signal when
either a child or a router neighbor entry is being added or removed.
This change replaces and enhances the previous APIs relalted to child
table callback.
2019-05-21 21:35:39 -07:00
Yakun Xu 167362130c [android] disable some optional features (#3821)
This commit removes unnecessary features of OpenThread on Android platform.
This commit also removes features disabled in openthread-config-android.h so
that these definitions can be overridden in Android.mk without warning.
2019-05-21 18:01:53 -07:00
Kamil Sroka fcac459e05 [nrf528xx] add missing include guards (#3849) 2019-05-21 09:44:22 -07:00
Jonathan Hui 86ac0865a3 [docs] update quick start guides to use dataset method (#3834) 2019-05-21 09:02:07 -07:00
Łukasz Duda 72b0708085 [thci] correct conversion of IPv6 prefix (#3846) 2019-05-21 08:32:46 -07:00
Jonathan Hui 8bb50d4ccd [ip6] add additional parse validation to Ip6::Address::FromString (#3843) 2019-05-20 20:37:19 -07:00
Kamil Sroka 607f7711e6 [nrf528xx] check for otPlatEntropyGet() reentrancy (#3842) 2019-05-20 13:49:21 -07:00
Kamil Sroka f2b19befb1 [mbedtls] add missing entropy/ctr_drbg errors to MbedTls::MapError() (#3841) 2019-05-20 12:21:17 -07:00
Kamil Sroka 32eead3290 [entropy] fix included headers in public API (#3840) 2019-05-20 08:57:28 -07:00
Abtin Keshavarzian 20aedd3dd4 [ncp] allow PARENT_RESPONSE_INFO property to be filtered by host (#3837) 2019-05-20 08:55:59 -07:00
Abtin Keshavarzian 2eba610ef6 [ncp-buffer] include APIs using otMessage only in FTD/MTD builds (#3836)
This commit changes the `NcpFrameBuffer` and `SpinelEncoder` classes
to include the support for adding of `otMessage` to the buffer and the
related APIs in the FTD/MTD builds (exclude it from the RADIO (RCP)
build).

Remove `Message` related source files from radio mode Makefile.
2019-05-20 08:54:31 -07:00
Abtin Keshavarzian 7b0537fb54 [tests] make pretty and update makefile (#3835)
* change the include order (make pretty)
* include header files in PRETTY_FILES
2019-05-20 08:52:49 -07:00
Jonathan Hui fa395d7205 [time-sync] remove reference operator in C API (#3833) 2019-05-20 08:50:43 -07:00
Łukasz Duda 8b544f000d [nrf52xx] notify if ACK was sent with frame pending bit set (#3831) 2019-05-17 18:53:07 -07:00
Kamil Sroka 56fa9ac9cd [entropy] allow for entropy source sharing (#3818) 2019-05-17 12:41:03 -07:00
Kamil Sroka fc580c39e6 [nrf52811] decrease number of buffers to free some RAM (#3818) 2019-05-17 12:41:03 -07:00
Jonathan Hui b7b0eecfe2 [ip6] add additional parse validation to Ip6::Address::FromString (#3830) 2019-05-16 21:39:32 -07:00
Kamil Sroka 4ee45b67d8 [nrf52840] add flag for enabling mbedTLS built-in threading support (#3828) 2019-05-16 21:39:15 -07:00
Jonathan Hui 7f0168cbc7 [da15000] remove unsupported platform (#3827) 2019-05-16 21:37:19 -07:00
Jonathan Hui ed23f050ad [cli] move dataset docs into separate file (#3825)
- Add quick start for forming network and attaching.
2019-05-16 21:36:52 -07:00
Jonathan Hui 934efbdf69 [dataset] add API to create new dataset for forming a network (#3825) 2019-05-16 21:36:52 -07:00
Jonathan Hui 73fea7a02c [channel-mask] move ChooseRandomChannel() to ChannelMask (#3825) 2019-05-16 21:36:52 -07:00
Jonathan Hui fa91da10ac [cli] add dataset init command to modify existing dataset (#3825) 2019-05-16 21:36:52 -07:00
Yakun Xu 6d155bebd2 [udp] expose an API to send UDP datagram (#3822)
This commit exposes an API to send UDP datagram, this is usefully when the
UDP receiver handler needs to send messages.
2019-05-16 14:22:03 -07:00
Abtin Keshavarzian 1284384bd8 [toranj] add test for SED attaching with multiple IP addrs (#3813) 2019-05-16 12:23:52 -07:00
Abtin Keshavarzian 0b396918c1 [mle] send shorter "Child ID Request" if needed to avoid frag (#3813)
This commit addresses the attach failure issue by an SED child trying
to register multiple IPv6 addresses in MLE "Child ID Request" message.
If the MLE "Child ID Request" requires fragmentation at 6LoWPAN layer,
this commit changes the code to abort the transmission and drop the
message and instead signal to MLE layer to prepare a shorter "Child ID
Request" by only including the mesh-local address in the `Address
Registration TLV`. After the child attaches, the new code will ensure
to trigger a "Child Update Request" exchange for the child to register
the remaining IPv6 addresses with its parents.
2019-05-16 12:23:52 -07:00
Jonathan Hui 06197eb7f5 [docs] fixup see-also in doxygen (#3824) 2019-05-16 08:28:51 -07:00
Łukasz Duda 21ad4f5da3 [nrf528xx] fix IAR warning (#3823)
This commit fixes IAR warning: undefined behavior: "the order of
volatile accesses is undefined in this statement"
2019-05-15 12:00:12 -07:00
Łukasz Duda 1a4b249a95 [ip6] add support for parsing embedded IPv4 address (#3819)
This commit facilitates the creation of the IPv6 address for NAT64 usage.
2019-05-15 08:55:05 -07:00
Łukasz Duda f42f6e5103 [nrf528xx] use Nordic's OUI in factory assigned IEEE EUI-64 (#3816) 2019-05-14 08:41:20 -07:00
Yakun Xu 4eca76a536 [spinel] fix outdated comment (#3814)
`OPENTHREAD_ENABLE_POSIX_APP` was merged into
`OPENTHREAD_PLATFORM_POSIX_APP`.
2019-05-13 10:35:12 -07:00
Abtin Keshavarzian 06ebaa767b [notifier] fix the #if check testing LOG_CORE being enabled (#3812) 2019-05-11 21:13:36 -07:00
Yakun Xu 27980027be [test] fix unclosed file (#3810)
This commit fixes python warning "ResourceWarning: unclosed file" when set
pexpect to None.
2019-05-11 09:58:06 -07:00
Yakun Xu 20a03b4075 [posix] use monotonic raw timer (#3809)
This commit enhances both posix-app and posix simulation to use the clock
CLOCK_MONOTONIC_RAW, which is supported on Linux and macOS. However, if
this clock is not available, it will fall back to CLOCK_MONOTONIC (for
BSD system).

On windows, it continues to use `gettimeofday()`.
2019-05-11 09:57:34 -07:00
Jiacheng Guo 5a7faa539f [mle] maintain best parent candidate during router-only search (#3803)
* maintain best parent candidate during router-only search
* add margin for duplicate parent request check
2019-05-11 09:56:26 -07:00
Yakun Xu 55da08861e [posix-app] add option to skip reset RCP (#3800)
This commit adds option `--no-reset` to OpenThread POSIX app to suppress
sending soft reset command when initializing OpenThread radio on host.
This is for NCP SPI bus scenario, where spi-hdlc-adapter is involved who
will trigger hardware reset at start.
2019-05-10 06:35:28 -07:00
Yakun Xu 333d5f7afb [spi-hdlc-adapter] reset NCP/RCP on exit (#3801)
This commit triggers resetting NCP/RCP on exit, which ensures NCP/RCP
get back to uninitialized state so that they will not respond to 15.4
messages.

Note, host should disable soft reset by passing `--no-reset` for RCP.
Thus OpenThread POSIX app doesn't need to reset RCP when it exits.
2019-05-09 21:28:20 -07:00
Thomas 246c5eaf33 [gp712] enforce cross compilation by default (#3805) 2019-05-09 14:21:46 -07:00
ltaoti 37f3a201bb [cc1352] fixes for integration with Texas Instruments examples (#3799)
* Fix otPlatRadioEnable always returning busy error

* Remove const from constructors
2019-05-09 14:20:11 -07:00
Thomas 505ba9cbeb [gp712] add include <stdbool.h> to resolve build issues (#3804) 2019-05-08 08:38:36 -07:00
Jonathan Hui 9368ea6c3a [6lowpan] return OT_ERROR_PARSE on MeshHeader::Init() failures (#3796) 2019-05-06 08:48:28 -07:00
Jonathan Hui 6f679e8fb0 [docs] update coap(s) docs (#3795) 2019-05-06 08:48:02 -07:00
Jonathan Hui d4063fe9b8 [cli] clean up coaps example implementation (#3795) 2019-05-06 08:48:02 -07:00
Marven Gilhespie 1b9c50112e [efr32] add support for entering EM2 low-power mode for sleepy devices (#3758)
Changes to EFR32 platform to allow entering EM2 low-power mode for sleepy devices
sleepy-demo applications added to examples/platforms/efr32.
2019-05-03 09:10:39 -07:00
Ciaran Woodward 0aa39f8d13 [doc] Add Cascoda to contributor list (#3794) 2019-05-02 09:08:27 -07:00
Jonathan Hui 408536b034 [docker] add build status badge (#3793) 2019-05-02 08:46:06 -07:00
Abtin Keshavarzian a80098bbc1 [toranj] add thread commissioning test (single joiner) (#3792) 2019-05-02 08:45:51 -07:00
Yakun Xu ae4ef9eb3e [timer] fix elapsed overflow (#3789)
This commit fixes a bug in the commissioner when a joiner's expiration
time has alerady elapsed.

This commit also introduces convenience methods for computing time
elapsed and diffs.
2019-05-02 08:44:37 -07:00
Ciaran Woodward 267a3b3e29 [cli] add 'childip' command to cli for getting ip addresses of MTD children (#3791) 2019-04-30 18:40:40 -07:00
Yakun Xu 617f8958dd [mesh-forwarder] verify data request is ack with fp=1 (#3785) 2019-04-30 18:37:48 -07:00
Abtin Keshavarzian d348ce2bbc [dtls] convert some of the info level logs to debug level (#3788) 2019-04-30 14:12:28 -07:00
Jonathan Hui 79e0dd21ce [docker] copy source rather than git clone to support CI (#3787) 2019-04-30 09:25:44 -07:00
Duda, Lukasz 0208d10563 [metadata] enhance ReadFrom and RemoveFrom methods (#3786) 2019-04-26 15:36:02 -07:00
Duda, Lukasz 1bd5920186 [joiner] remove potential memory leak (#3786) 2019-04-26 15:36:02 -07:00
Duda, Lukasz f45f822800 [coap] check error code on appending metadata (#3786) 2019-04-26 15:36:02 -07:00
Joseph Newman 988be2a7f6 [efr32] further UART driver refactoring (#3776)
- No  longer  queue  2x  32-byte  buffers  for   UART  receive.  Upon
  investigation, the  RAIL library switches these  buffers in software
  (within the  same ISR context as  `receiveDone`), so it  seems to be
  pointless  from  a   performance  perspective  in  queuing  multiple
  buffers. Instead, now work with 64-byte buffers.

- Refactored `updateReceiveProgress` so that extra variable
  `mLastCount` isn't required.

- Extensive testing at higher baud rates revealed race conditions and
  some issues with detecting buffer full conditions.

- Added comments to clarify the logic

- Removed asserts after returning from RAIL library
  functions. Contrary to my previous arguments, if the behaviour of
  the RAIL library functions changes in the future (with regards to
  the errors it returns), then somebody would have to remember to
  check these asserts were still appropriate.
2019-04-26 08:41:52 -07:00
rongli cee20c6a66 [data-poll-manager] fix unexpected interval (#3780) 2019-04-26 08:38:13 -07:00
Jiacheng Guo f5ee3a5e65 [posix-app] timeout for rcp radio driver (#3749) 2019-04-24 16:06:39 -07:00
Jonathan Hui c972c5cb93 [network-data] add bounds check when comparing server data (#3781) 2019-04-24 10:17:07 -07:00
Jonathan Hui 4e45b45796 [dataset] allow setting partially complete active dataset (#3773)
When a partial dataset is stored, the device will attempt to attach to a
Thread network using the limited parameters available. If the device
successfully attaches, the device will then obtain the complete Active
Dataset from its Parent. If the device is router-capable, it will not
become a Router/Leader until it has successfully retrieved a complete Active
Dataset.

Saving a partial dataset supports out-of-band commissioning scenarios.
2019-04-23 22:10:40 -07:00
rongli c5537e1b01 [data-poll-manager] add StopFastPolls() support (#3763) 2019-04-23 22:10:08 -07:00
rongli 2be525b352 [mle] allow attach and link sync between different Thread versions (#3779) 2019-04-23 09:00:45 -07:00
Abtin Keshavarzian f184a9462b [meshcop] clip long strings for vendor name, model, version, data (#3778)
This commit ensures that if the passed-in string args (vendor name,
model, sw version, data or provisioning URL) in `Joiner::Start()`
are too long, they are clipped to the max size defined by the
corresponding TLVs.
2019-04-23 08:59:40 -07:00
Abtin Keshavarzian 99f5790a49 [ncp] add spinel_meshcop_joiner_state_t enumeration (#3774)
This commit defines an enumeration in spinel for Joiner state which
is related to property `SPINEL_PROP_MESHCOP_JOINER_STATE`.
2019-04-22 10:04:54 -07:00
Jonathan Hui 5adac06d08 [logging] fix BeaconPayload::ToInfoString() print of network name (#3771)
`BeaconPayload::GetNetworkName()` does not return a NULL-terminated string.

This commit fixes `BeaconPayload::ToInfoString()` to pass a NULL-terminated
string to the string formatter.
2019-04-18 13:42:33 -07:00
Jonathan Hui a09d8da38c [mpl] discard datagrams with multiple MPL Options (#3764)
Credit to OSS-Fuzz.
2019-04-18 13:29:59 -07:00
Piotr Szkotak 8ff7950cd2 [nrf52840] update Nordic example CDC ACM driver (#3772) 2019-04-18 08:46:28 -07:00
Jonathan Hui 24307f1ba9 [pskc] set random PSKc when generating a new Active Dataset (#3769)
When generating a new Active Dataset, the current PSKc value is used. Because
the PSKc is initialized to all zeros, new Active Datasets have a default
PSKc value of all zeros.

This commit checks if the PSKc has been set (i.e. not all zeros) and, if not
set, generates a random PSKc when creating a new Active Dataset.
2019-04-18 08:45:14 -07:00
Jonathan Hui f46fbb844d [pskc] switch to using otPSKc struct (#3769) 2019-04-18 08:45:14 -07:00
Abtin Keshavarzian 987e96ba0d [ncp] update MESHCOP_JOINER_COMMISSIONING to allow vendor info to be given (#3767)
This commit updates `SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING`
definition to allow vendor info (name, model, sw version, data) to be
specified. All new parameters are optional and if not specified in the
spinel frame (or an empty string is given), OpenThread default values
will be used instead.

This change in `SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING` format keeps
it backward compatible with previous definition, ensuring any driver
using the previous format will be parsed in the same way.
2019-04-17 19:08:11 -07:00
Shu Chen bd2e3ef8f9 [radio-spinel] exit if it fails to get radio channelmask from rcp (#3760) 2019-04-16 11:16:53 -07:00
rongli 8fd8d1e0f9 [mle] enter fast poll mode when dequeue delayed MLE Data Request (#3761) 2019-04-16 10:28:14 -07:00
Joseph Newman 02463bdda1 [efr32] improve USART driver error handling (#3745)
* efr32 uart dma changes
* correct handling of queue full
2019-04-16 09:40:01 -07:00
Jonathan Hui d6e58b15ca [mle] do not apply active dataset from settings after attaching (#3762)
A device should use the Active Dataset in use by the partition that it is
attached to, not the one stored locally in non-volatile.
2019-04-16 08:23:10 -07:00
Kamil Sroka 9fa48b54a8 [nrf528xx] don't return OT_ERROR_FAILED from otPlatRadioTransmit (#3757) 2019-04-16 08:22:29 -07:00
Abtin Keshavarzian db3ea162a8 [message] add and use AppendTlv (#3752)
This commit adds a new method `AppendTlv` to `Message` class which
appends a fully formed TLV to the message. This commit also changes
the core modules to use the new method when appending a TLV.
2019-04-16 08:21:45 -07:00
Łukasz Duda 62b35b67c3 [nrf52840] update README.md after SDK release (#3759) 2019-04-15 08:38:18 -07:00
Łukasz Duda d3fdf84ee0 [platform] return error on incorrect otPlatRadioDisable usage (#3756) 2019-04-15 08:36:47 -07:00
Jonathan Hui bd517c9bf2 [ip6] clean up return values for otIp6Send() (#3751)
- Return OT_ERROR_PARSE when encountering mal-formatted headers.
- Return OT_ERROR_NO_ROUTE when there is no route to host.
- Document possible return values for `otIp6Send()`.
2019-04-12 08:48:35 -07:00
Jonathan Hui b7b085c9f9 [fuzz] advance alarm time to cover timer handlers (#3753) 2019-04-11 11:59:20 -07:00
Abtin Keshavarzian b1ac8a4f19 [joiner] remove static requirement for vendor parameters in Start() (#3748)
This commit updates the `Joiner` class implementation to remove the
requirement for `Start()` vendor related parameters (vendor name,
model, sw version, data) to be static (string). This is done without
requiring the `Joiner` class to use member variables to store/copy
the strings by preparing the "Joiner Finalize" message early on (note
that these parameters are included in this message) and keeping track
of the dynamically allocated `Coap::Message` pointer instead.
2019-04-11 10:11:59 -07:00
Abtin Keshavarzian eab62dd699 [spi-hdlc-adapter] allow log level to be changed (#3747)
This commit contains the following improvements  in
`spi-hdlc-adapter`:

- It changes the default syslog log level to `LOG_WARNING`.
- It enhances the `--verbose[=num]` option to allow negative values
  to reduce the log level. Note that this change keeps the behavior
  backward compatible (it is an add-on).
- It updates the `print_help()` and the `README.md` files to document
  new behavior of `--verbose` option.
2019-04-10 08:33:20 -07:00
Yakun Xu 2bacf31731 [travis] support clang code coverage (#3741) 2019-04-10 08:31:53 -07:00
Jonathan Hui 5f95995c65 [nlbuild-autotools] update to 1.6.6 (#3746) 2019-04-09 20:58:00 -07:00
Jonathan Hui 5ce1e001d2 Squashed 'third_party/nlbuild-autotools/repo/' changes from 75faaf5f..d4c1c470
d4c1c470 Merge pull request #18 from bukepo/code-coverage/fix-for-clang
21fb7d7b bump version and update changes
271abad7 Add code coverage for clang
3597c61e Merge pull request #17 from nestlabs/bug/fix-repos-remake-issue

git-subtree-dir: third_party/nlbuild-autotools/repo
git-subtree-split: d4c1c47033060e6f6bbd6b9203e2d1ed26107979
2019-04-09 19:59:02 +00:00
Jonathan Hui 68260c2ed3 Update to reflect upstream repository 'https://github.com:nestlabs/nlbuild-autotools' at tag '1.6.6'. 2019-04-09 19:59:02 +00:00
Jonathan Hui ae04d59280 [lowpan] suppress unchecked return warning in Lowpan::Compress() (#3740) 2019-04-08 21:25:37 -07:00
Shu Chen a43a263a0c [api] remove otLinkGetPhyChannel*() Link APIs (#3736) 2019-04-08 21:25:16 -07:00
Yakun Xu bbb19c2aa2 [radio] only allow disable in sleep state (#3733)
There's missing error definition for otPlatRadioDisable(). This commit adds
an error case OT_ERROR_INVALID_STATE to make sure this is only called
when the radio is in sleep mode.
2019-04-08 21:24:52 -07:00
Joseph Newman 5d2e6cd0d9 [efr32] take advantage of DMA for efr32 USART receive (#3730) 2019-04-08 10:39:45 -07:00
Shu Chen 4c06b47c34 [channelmask] add radio supported and preferred channel mask (#3732)
Add new radio platform APIs:
 * otPlatRadioGetSupportedChannelMask(); // supported channel mask: the device is allowed to be on;
 * otPlatRadioGetPreferredChannelMask(); // preferred channel mask: the device prefers to form on.

Implement some default radio platform APIs.

Add spinel property `SPINEL_PROP_PHY_CHAN_PREFERRED` to retrieve Preferred ChannelMask.
2019-04-08 10:35:18 -07:00
Yakun Xu 174d076722 [radio-spinel] parse frame rx timestamp (#3731)
This commit parses rx timestamp of radio frame received by RCP, no matter
data frames or ACK frames.

* add OT_NUM_ERRORS as number of defined errors.
* allow empty SPINEL_DATATYPE_DATA and SPINEL_DATATYPE_DATA_WLEN when
parsing spinel packets.
2019-04-07 21:34:40 -07:00
Abtin Keshavarzian 7c3bce3a4f [toranj] verify "RCPVersion" is gettable on posix-app mode (#3735)
This commit updates the `test-001` to allow extra properties to
be verified when running under posix-app model. The new test
ensures "POSIXApp:RCPVersion" is gettable.
2019-04-06 22:57:25 -07:00
Abtin Keshavarzian 6e718a1c76 [ncp-base] fix the #if check for posix-app (#3735) 2019-04-06 22:57:25 -07:00
ozanoner 37a662197f [coap] remove otCoapMessage from CoapSecure::DefaultHandler() (#3737) 2019-04-06 21:54:07 -07:00
Łukasz Duda 9847be8328 [build] fix build with announce sender enabled (#3739) 2019-04-06 21:41:45 -07:00
Yakun Xu 33b903bc62 [posix-app] fix conversion warnings (#3738)
This commit fixes conversion warnings and also adjusts one travis test to
check these kind of issues.
2019-04-06 21:40:54 -07:00
Abtin Keshavarzian 83c9270c29 [joiner] update Joiner implementations
This commit contains the following changes to `Joiner` class
implementations:

- Notifier events are signaled on all `Joiner` state changes
  and are logged (through use of `Joiner::SetState()`).
- Discover scan during join uses filtering (removes the need
  to perform filtering by the `Joiner` class itself).
- `Joiner::Stop()` is changed to allow it to be called at any
  stage of join process and it correctly cleans all states.
- Priority assignment to discovered networks is updated/fixed
  (prioritizing networks with an exact match of Joiner ID in their
  Steering Data compared to ones that allow all joiners, and
  sub-prioritize based on signal strength).
- Logs are updated.
2019-04-04 09:14:30 -07:00
Abtin Keshavarzian 873a710a1a [mle] update discover scan filtering
This commit makes improvements to MLE Discover Scan implementation,
mainly the steering data filtering logic:
- The SHA-256 of EUI64 (Joiner ID) and then the related bloom filter
  CRC-CCIT and CRC-ANSI indexes are calculated and saved at start of
  scan operation (removing the need to re-calculate them on every scan
  result).
- When filtering is enabled, a Discover Scan result with no Steering
  Data is now rejected.
- `Mle` class member variables related to discover scan operation
  are renamed to start with `mDisocver` prefix.
2019-04-04 09:14:30 -07:00
Yuzhuo Yang c02a985609 [diag] use OT_ARRAY_LENGTH to unify code and shrink image size (#3677) 2019-04-03 21:52:07 -07:00
Abtin Keshavarzian 6dc3b28b3f [radio-spinel] add meta-data (CSMA/retry counts) in STREAM_RAW property set (#3727)
This commit updates `RadioSpinel::RadioTrasnmit()` to include the
`otRadioFrame` parameters (max CSMA backoffs, max frame retries, and
CSMA-CA enabled flag) as part of meta-data in `PROP_STREAM_RAW`
property `VALUE_SET` command.
2019-04-03 17:03:27 -07:00
Abtin Keshavarzian a4614ac795 [ncp] decode meta-data (CSMA/retry counts) in STREAM_RAW property set (#3727)
This commit adds logic to decode and use the optional meta-data fields
in a `VALUE_SET` command (frame tx request) for `PROP_STREAM_RAW` in
raw-link or radio only (RCP) mode. The optional meta-data fields map
to definitions in `otRadioFrame` to specify number of CSMA backoffs
attempts, frame retry attempts, whether to enable CSMA-CA for this
frame or not. If any optional field is not included, default value
is used instead. This aligns the implementation with specification
of `PROP_STREAM_RAW` in `spinel.h`.
2019-04-03 17:03:27 -07:00
Yakun Xu 8c0fed1c22 [posix-app] fix alarm issue when time changed (#3728)
Current posix app uses gettimeofday() to get time, which will be affected
by system time changes, and results in alarm not fired. This commit uses
clock_gettime() instead to avoid this issue.
2019-04-02 14:59:17 -07:00
Abtin Keshavarzian c862afc6b3 [mac-filter] hide the mFiltered in public filter APIs (#3722)
This commit improves the `Mac::Filter` implementation. It mainly
removes the internally used `mFiltered` variable from the public
`otMacFilterEntry` definition and moves it inside `Mac::Filter`
private definitions.
2019-04-02 10:20:22 -07:00
Abtin Keshavarzian b6a539c8d5 [code-utils] add OT_ARRAY_END() macro (#3722)
This commit adds `OT_ARRAY_END(aArray)` macro which returns a
pointer to the end of a given array (pointing to the past-the-end
element).
2019-04-02 10:20:22 -07:00
Yakun Xu dd1e0f4695 [cli] add legacy stub in cli (#3729)
This commit adds stubs for legacy APIs.
2019-04-02 09:11:46 -07:00
Abtin Keshavarzian 8f112eeb5a [locator] adding Get<Type> to InstanceLocator (#3714)
This commit changes how the objects in OpenThread access each other.
It adds a template `Get<Type>()` method in `InstanceLocator`. This
method returns a reference to a given `Type` object belonging to the
OpenThread instance (e.g. `Get<MeshForwarder>()` returns a reference
to `MeshForwarder` object on the OpenThread instance). The
`InstanceLocator` is used as base class of all OpenThread classes so
every class can easily access any other object. This commit also
changes how the main instance is retrieved in `InstanceLocator` for
the single-instance case. The method `GetInstance()` directly uses the
raw buffer `gInstanceRaw`. This change helps make the `GetInstance()`
and in turn all `Get<Type>()` methods in-line. This commit also
removes the existing getters across all classes to use the new
`Get<Type>()` model.
2019-04-02 09:07:25 -07:00
Łukasz Duda 9dfa4e2b31 [nrf528xx] remove unnecessary dependencies from app_error_weak implementation (#3725) 2019-04-01 09:06:43 -07:00
Abtin Keshavarzian 2daa892f56 [dataset] use Read/Save method names instead of Get/Set (#3723)
This commit renames methods in `DatasetLocal`, `DatasetManager`,
'ActiveDataset' and `PendingDataset` to use `Read()` and `Save()`
in place of `Get()` and `Set()` respectively. This aligns the
names with `Setting` class indicating that these method do
read/save Dataset info in non-volatile memory.
2019-04-01 09:05:58 -07:00
Jiacheng Guo 88912d23ae [nrf52840] signal event in usb cdc (#3715) 2019-04-01 09:05:10 -07:00
dismirlian 81fd8a8b10 [examples] software implementation of source match table (#3717)
* [examples] add software implementation of source match table

* [efr32] modify radio driver to use generic implementation of source match table

* [efr32] configure soft source match table PAN ID
2019-04-01 08:52:47 -07:00
Jonathan Hui 19544490e3 [style] replace reinterpret_cast with static_cast where possible (#3718) 2019-03-28 22:29:58 -07:00
Joseph Newman ecad71733d [ncp] add service spinel bindings (#3659)
* add spinel bindings for service add/remove/get
* add leader services query
2019-03-28 22:29:25 -07:00
Jeff Bumgardner ca0b1d8229 [docs] fix instances of "the the" in comments (#3720) 2019-03-27 18:44:41 -07:00
Łukasz Duda 0b6cd5b115 [nrf528xx] add otSysEventSignalPending call in spi-slave driver (#3716) 2019-03-27 08:47:13 -07:00
Jonathan Hui 3b41c7ef44 [fuzz] advance alarm time to cover timer handlers (#3710) 2019-03-26 12:17:31 -07:00
dismirlian 24d5d3db66 [efr32] minor enhancements to radio driver (#3713)
* Add static linkage to local functions

* Simplify clearing checksum of source match table entry
2019-03-26 08:53:10 -07:00
Jonathan Hui 1fefe2e683 [dtls] return error on multiple calls to Dtls::Open() (#3709) 2019-03-25 08:36:19 -07:00
Jonathan Hui a9e0fe9ec6 [udp] add Udp::IsBound() method (#3708) 2019-03-25 08:35:56 -07:00
Yakun Xu 23ff1015d4 [core] change return type of otMessageRead() (#3707) 2019-03-22 08:12:55 -07:00
Jonathan Hui 49c4b63491 [style] make parameter names consistent across decls and defs (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui d32ca03a8b [style] remove redundant control flow (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui 0de1fff570 [style] remove redundant declarations (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui 63cf08d04a [style] const-qualify pointer args where possible (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui cadfc6d299 [style] remove static member access through instances (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui c7cd21f8b7 [style] remove const values in declarations (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui e00114b3f1 [style] mark single-arg constructors as explicit (#3705)
Avoids unintentional implicit conversions.
2019-03-22 08:12:26 -07:00
Jonathan Hui f2d93917c2 [style] remove using decls from global namespace in headers (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui 8656101724 [style] remove unused using decls (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui 2ab9b49042 [style] use C++-style casts (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui 8ed382207d [efr32] fix build issues when sub-GHz support is not configured (#3704) 2019-03-22 08:11:56 -07:00
Yakun Xu 5f220682cd [tests] add an inspector for travis certification tests (#3700)
This commit adds a debugger to inspect nodes status.
2019-03-22 08:11:39 -07:00
rongli 1b8b797919 [netdata] fix stable network data version when service updates (#3702) 2019-03-21 12:13:20 -07:00
Yakun Xu e3d0368070 [travis] remove unused sources (#3701)
This commit removes unused sources from apt update list to avoid fetch
failures.
2019-03-21 08:21:18 -07:00
Jonathan Hui 4f734fa24f [udp] return error on source port mismatch in Udp::SendTo() (#3698) 2019-03-20 03:18:51 -07:00
Jonathan Hui b6ef4988f3 [travis] add travis_retry to before_install (#3697) 2019-03-19 21:17:45 -07:00
Jonathan Hui aaaae937d3 [style] prefer OT_UNUSED_VARIABLE (#3696) 2019-03-19 21:17:33 -07:00
Irving-cl a637cdccf4 [tests] add test case Cert_9_2_02 (#3589)
1. Add new test case **Cert_9_2_02**. Since the test case contains 2
topologies, added 2 new files:
- `Cert_9_2_02A_MGMTCommissionerSet.py`,
- `Cert_9_2_02B_MGMTCommissionerSet.py`.

2. Add mesh_cop tlvs parsing. The corresponding file is
`mesh_cop.py`. The mesh_cop tlvs are used in many cases. For example,
`CommissionerSessionId` is used in both the parsing of **Commissioning
Data**(in mle) and the parsing of **CoAP**. Collected all mesh_cop
tlvs refered in Thread into this file with some unused tlvs
unimplemented.

3. Reuse `SubTlvsFactory` in `network_data.py`. `SubTlvsFactory` are
used to choose the corresponding factory of specific tlv and do the
parsing of it. The `NetworkLayerTlvsFactory` in `network_layer.py` had
exactly the same function with it (almost the same code). Moved the
`SubTlvsFactory` into a new file `tlvs_parsing.py` and change the
usage in `network_data.py` and `network_layer.py`. This helps us
remove some redundant code.

4. Some format issues. Remove some trailing spaces.
2019-03-19 21:17:15 -07:00
Łukasz Duda a3f398b30f [doc] update documentation of CLI counters command (#3695) 2019-03-19 14:00:55 -07:00
Jonathan Hui c0de3be7f3 [dtls] cleanup method names (#3694)
- Rename Close() to Disconnect() to better pair with Connect()
- Rename Stop() to Close() to better pair with Open()
- Make Setup() private.
2019-03-18 22:58:38 -07:00
Jonathan Hui a39f2c86d3 [dtls] do not allow Open() or Bind() when DTLS session is started (#3694) 2019-03-18 22:58:38 -07:00
Abtin Keshavarzian 8bddf61ae2 [toranj] add test to cover OT/NCP SLAAC module behavior (#3688)
This commit updates and renames the existing `test-026-slaac-address`
to indicate that it covers the behavior of `wpantund` related to
SLAAC address management (in `test-026` we disable NCP SLAAC module).

It adds a new test `test-030-slaac-address-ncp` to cover behavior of
OpenThread/NCP SLAAC module:

- Verify that adding prefix (with SLAAC flag) causes a corresponding
  SLAAC IPv6 address to be added.
- Verify that removing the prefix would remove the SLAAC address.
- Verify behavior when same prefix is added and removed on multiple nodes
  (with or without SLAAC flag).
- Check behavior when an IPv6 address with the same prefix already exists.
- Check behavior when the address with same prefix is removed (SLAAC module
  should add a SLAAC address upon removal of the address).
- Verify that removal of prefix does not remove user-added addresses with
  same prefix.
- Verify disabling SLAAC module removes any previously added SLAAC
  addresses, and re-enabling it adds them back (with same IID).
- Check behavior when prefix is added while SLAAC module is disabled and
  then enabled later.
2019-03-18 22:58:13 -07:00
Jonathan Hui 037896c5cd [meshcop] fix doxygen in ChannelMaskTlv::SetChannelMask() (#3693) 2019-03-18 16:54:20 -07:00
Yakun Xu 728e19b47a [cli] avoid input overflow (#3691) 2019-03-18 09:01:02 -07:00
Jonathan Hui fab45352f5 [meshcop] process ChannelMaskTlv in message (#3690)
Allows arbitrary number of Channel Mask entries.
2019-03-15 21:46:02 -07:00
Zhanglong Xia 61e9288805 [ip6] correct annotations (#3692) 2019-03-15 21:39:23 -07:00
Yakun Xu ea459d4cc3 [posix-app] fix debug flag (#3689) 2019-03-14 21:58:48 -07:00
Abtin Keshavarzian 6256b5cdde [link-raw] log frame tx attempt failures (#3687)
This commit adds logs to indicate frame tx attempt failures on
`LinkRaw` class for RCP model.
2019-03-14 19:55:21 -07:00
Zhanglong Xia 1af2933449 [efr32] enable BRD4170A to support 915MHz and 2.4GHz by default (#3664) 2019-03-14 09:44:35 -07:00
Yakun Xu dea08b2db7 [posix-app] add readline for CLI (#3511) 2019-03-13 23:32:32 -07:00
Jonathan Hui 160ef467e6 [dtls] handle MBEDTLS_ERR_PEM_ALLOC_FAILED in Dtls::MapError() (#3674) 2019-03-13 23:20:56 -07:00
Abtin Keshavarzian 89396ab5d3 [ncp] add SLAAC related spinel capability and property (#3667)
This commit adds `SPINEL_CAP_SLAAC` which indicates to host whether
SLAAC feature is supported. It also adds `SPINEL_PROP_SLAAC_ENABLED`
spinel property to let host enable/disable SLAAC module at run-time.
2019-03-13 23:20:41 -07:00
Abtin Keshavarzian cce16b6dda [slaac] add IsEnabled() method and public API otIp6IsSlaacEnabled (#3667) 2019-03-13 23:20:41 -07:00
Zhanglong Xia ce24abb7bb [api] rename ChannelMaskPage0 to ChannelMask (#3665) 2019-03-13 07:49:25 -07:00
Kamil Sroka a99816a225 [nrf52811] add emulation on nRF52840 to README.md (#3682) 2019-03-12 23:27:42 -07:00
Łukasz Duda 039aab3fa0 [nrf52840] handle NRF_ERROR_BUSY from SD in flash driver (#3680) 2019-03-12 23:27:16 -07:00
Yakun Xu a6a2f963d9 [posix-app] more baudrates on macOS (#3675) 2019-03-12 23:26:32 -07:00
Jonathan Hui 950c7c8612 [meshcop] avoid shift exponent too large in ChannelTlv processing (#3673) 2019-03-12 10:47:25 -07:00
Jonathan Hui e82531507b [meshcop] make length checks more strict on ChannelMaskTlv parsing (#3672) 2019-03-12 10:47:12 -07:00
Jonathan Hui 92e4d89f64 [travis] check/fix EOF newline on pretty/pretty-check (#3671) 2019-03-12 10:46:58 -07:00
Jonathan Hui 498034fba5 [travis] remove posix-app-ncp test due to frequent failures (#3683) 2019-03-12 10:43:11 -07:00
Łukasz Duda 70b29674f6 [build] fix warning in SLAAC module in Keil (#3666) 2019-03-11 22:07:47 -07:00
Abtin Keshavarzian 906fe0dffc [spinel] add spinel definition guideline (#3663) 2019-03-11 21:28:04 -07:00
Abtin Keshavarzian 9c2b8815ba [ncp] report 2.4GHz and/or 915MHz support from SPINEL_PROP_CAPS (#3662) 2019-03-11 21:27:41 -07:00
Abtin Keshavarzian dd69fabd2d [spinel-decoder] fix comments (#3661) 2019-03-11 09:40:32 -07:00
Yakun Xu f695ccae22 [dtls] simplify logging (#3660) 2019-03-11 09:38:58 -07:00
Yuzhuo Yang da9ba9cbdc [diag] add radio sleep / receive mode for RF certification (#3657)
Bug: 127894959
2019-03-11 09:37:52 -07:00
Abtin Keshavarzian 58f144a7f7 [slaac] enhance and simplify SLAAC support (#3621)
This commit enhances the SLAAC support in OpenThread core. It contains
the following changes and features:

The `Utils::Slaac` class is updated to include all the related code
for managing SLAAC addresses (e.g., `Slaac` class maintains the
address buffer and directly subscribes to `Notifier` to listen for
Network Data changes to update SLAAC addresses).

The SLAAC address module is changed to support and use semantically
opaque IID generation algorithm (RFC 7217) instead of random IID
generation. This ensures that SLAAC addresses are random but stable
(i.e., the same SLAAC address is added on a device for the same
prefix) and aligns the implementation with Thread specification
requirement.

The semantically opaque IID generation logic is updated to follow RFC
7217 with SHA-256 as the pseudo-random function, and a 256 bit secret
key (generated once using true random number generator and saved in
non-volatile settings).

A new feature is added to allow SLAAC support to be enabled or
disabled during network operation. When enabled, SLAAC addresses are
generated and added to the interface. When disabled, any previously
added SLAAC address is removed.

This commit also adds "SLAAC prefix filter" feature which allows
OpenThread users to register a filter handler with SLAAC module. The
handler is invoked by SLAAC module when it is about to add a SLAAC
address based on a prefix. The returned boolean value from the handler
determines whether the address should be filtered or not.
2019-03-11 09:35:07 -07:00
RaKu 6453c9f033 [nrf52840] do not specify interface protocol in USB CDC (#3658)
bInterfaceProtocol descriptor previously indicated that AT V.250 commands
were supported by the device. This could cause issues with applications
managing modems.
2019-03-08 08:28:26 -08:00
Yakun Xu 7a0eb2c2e7 [dtls] refine CoAP secure and DTLS (#3632)
`CoapSecure` is always used by joiner, border agent or commissioner.
DTLS should not be shared with the application `CoapSecure`.

This commit includes the following changes:
* allow multiple DTLS by using `TimerMilliContext`
* move `CoAP::mSocket` into `Dtls`
* move `ThreadNetif::mDtls` into `CoapSecure`
* remove unnecessary getters of `Dtls` and `CoapSecure`
2019-03-08 08:11:41 -08:00
Zhanglong Xia 96725a985e [phy] add support for OQPSK modulation in 915MHz band (#3378) 2019-03-08 08:09:55 -08:00
Jonathan Hui 4610811781 [docs] udpate borderrouter repo name to ot-br-posix (#3655) 2019-03-08 07:51:59 -08:00
Jonathan Hui 5e4d07cb23 [dtls] fix bug in resetting dtls state on error (#3653) 2019-03-07 09:12:56 -08:00
Jonathan Hui 2805ca463b [meshcop] fix buffer overflow in Commissioner Session ID compare (#3652)
Credit to OSS-Fuzz.
2019-03-07 09:12:43 -08:00
Jonathan Hui 0938be7f84 [dhcp6] clean up Prefix Agent state management in DHCPv6 server (#3646)
* introduce a new class for managing Prefix Agent state
* combine prefix and ALOC into the same class
2019-03-07 09:12:20 -08:00
Abtin Keshavarzian 62971bfe93 [router-table] simplify router table code (#3644)
This commit adds a simple internal helper class `RouterIdSet` in
`RouterTable` to store the allocated router IDs bitset. This commit
also renames the `for` loop variable names (`routerId` when iterating
over all router IDs and `index` used for `mRouters` array index)
2019-03-05 10:51:13 -08:00
Yakun Xu 4acd8b7aab [build] fix SLAAC switch (#3645) 2019-03-05 10:45:22 -08:00
Jiacheng Guo ab12b47182 [posix] do not exit on EINTR in UART (#3643) 2019-03-04 08:38:28 -08:00
rongli 11339835e4 [mle] do not echo back ML-EID registered by MTD (#3640)
* do not echo back ML-EID registered by MTD
* update the address registration check in Cert_7_1_01 and Cert_7_1_03
2019-03-04 08:36:27 -08:00
Irving-cl dcc13419c3 [thci] match meshlocalprefix accurately to classify the addresses correctly (#3639) 2019-03-04 08:31:16 -08:00
Yakun Xu bf794ca5f2 [mle] fix oob steering data length (#3638) 2019-02-28 23:45:45 -08:00
Yakun Xu 6705fe83f3 [time-sync] fix time sync and typo (#3637)
* fix typo in common-switches
* fix segment fault with time sync enabled
2019-02-28 10:28:16 -08:00
Stuart Longland 74ad300556 [cc2538] fix RSSI calibration when CC2592 is in use (#3636)
* Define parameter for RSSI offset.

This defines the RSSI offset as an overridable parameter in the CC2538
configuration for users that have installed a CC2592 on their board but
have hard-wired the HGM pin either to `VDD` or `GND`.

* Calibrate RSSI according to HGM state.

I had actually misread the datasheet a little bit, having gotten
sensitivity and RSSI offset confused.  The values I needed for the
sensitivity were actually in the table *above* where I got the original
figures here from.

This puts the *correct* figures in place, and also defines a function
that returns the RSSI offset based on the state of the HGM pin (or
returns a static value if we omit CC2592 support or disable HGM
control).

* Expose RSSI offset setting in Makefile

* Document RSSI offset parameter
2019-02-28 08:18:56 -08:00
Łukasz Duda db945a5278 [nrf528xx] update platforms README.md (#3633) 2019-02-28 08:17:00 -08:00
wgtdkp d3791348d1 [tests] enhance Cert_8_1_01_Commissioning (#3457) 2019-02-27 19:16:02 -08:00
Piotr Szkotak 096632a475 [nrf528xx] add radio and random platform fixes (#3634)
* [nrf52811] add radio and random platform fixes

* [nrf528xx] handle all radio driver rx/tx errors
2019-02-27 12:41:41 -08:00
Joseph Newman f9884b8afc [efr32] implement otPlatRadioEnergyScan API (#3631)
* refactor for energy scan API

* rename enum, init status in init func, tidy up and fix issue in GetRssi

* add cast and fix start energy scan error return
2019-02-27 12:03:51 -08:00
Yakun Xu ceed19c4b5 [posix-app] cause compile failure for SPI bus (#3630) 2019-02-26 15:52:47 -08:00
wgtdkp dc947f0152 [tests] support testing commissioning (#3441)
Add support for testing commissioning process, including:

1. Add DTLS, Thread Discovery and commissioning messages(JOIN_FIN.req etc) parsing;
2. Support parsing log from UART response, and construct decrypted messages;
3. Common commands for commissioning related verification;
2019-02-26 15:49:57 -08:00
Yakun Xu cc37bd1dfb [coaps] fix disconnected (#3623)
When DTLS is disconnected, the socket should also be disconnected from
the previous peer.
2019-02-26 15:41:59 -08:00
Yakun Xu 127e3bb84e [posix-app] clean up posix app defines (#3611) 2019-02-26 13:28:37 -08:00
Jonathan Hui e7acaa8879 [mesh-forwarder] do not allow eviction of message being processed (#3629)
Processing a message may trigger an Address Solicit message to be sent.
Because Thread control messages have higher priority, it is possible for the
Address Solicit message to evict the data message that caused the generation
of the Address Solicit message.

This commit present a message that's being processed from being evicted.

Credit to OSS-Fuzz.
2019-02-25 18:57:36 -08:00
Jonathan Hui 13bd1db1f7 [dtls] do not free mbedtls context if one is already being used (#3628) 2019-02-25 18:36:51 -08:00
Jonathan Hui a3548df579 [network-data] add check for prefix length (#3626) 2019-02-25 18:36:36 -08:00
Jeff Bumgardner d912393c7f [docs] add STMicroelectronics to the list of supporters (#3627) 2019-02-25 16:01:54 -08:00
Joseph Newman 02d33b9bb9 [efr32] fix cannot compile with log output OPENTHREAD_CONFIG_LOG_OUTPUT_APP (#3625) 2019-02-25 09:27:37 -08:00
Jonathan Hui 5cf3540f6e [efr32] unify flash config around SETTINGS_CONFIG_PAGE_NUM (#3620) 2019-02-25 09:26:26 -08:00
Yakun Xu a0db3b5b46 [posix-app] fix daemon uart send done (#3622) 2019-02-22 21:56:02 -08:00
Kamil Sroka 203bce7ae7 [nrf528xx] update usbd (#3618) 2019-02-22 09:00:57 -08:00
Jonathan Hui 3eb5a106ff [fuzz] process pending tasklets to increase coverage (#3617) 2019-02-22 09:00:23 -08:00
Jonathan Hui b7a9e7afd7 [tests] add conditionals around unit tests (#3616) 2019-02-22 09:00:01 -08:00
Stuart Longland fd2503e792 [cc2538] add support for CC2538-CC2592-EM (#3609)
* [cc2538] Define registers for control of CC2592.

In order to set up the signals needed to drive the CC2592 front-end, we
need to expose a few registers in the radio module that route internal
module signals to pins on Port C.

TI also recommend hooking the HGM pin of the CC2592 to a GPIO pin so
that the high-gain mode can be software-controlled.  It can be connected
to any GPIO pin, but they call out PD2 specifically for this, so we need
to configure GPIO port C & D.  Since we're here, we'll add B as well.

Some macros of convenience are also added for accessing the Nth element
in an array of 32-bit registers, as well as computing the bit mask of
the Nth GPIO pin.

* [cc2538] Define configuration settings for CC2592.

By default, we disable support for the CC2592 as we do not wish to break
existing OpenThread instances.  The configuration parameters allow
customisation of the locations for the `PA_EN`, `LNA_EN` and `HGM`
signals (within the constraints of the CC2538) for cases where people
have moved the signals around on custom boards.

The defaults work with designs derived off the CC2538-CC2592 EM
reference design.

* [cc2538] Define control interface for HGM pin.

Since the `HGM` signal is under software control, we need to be able to
allow the software to turn it on or off as required.  This exposes two
functions, one of which queries the current state (by looking at the
GPIO register bit-mask), and the other provides a means to change the
state.

* [cc2538] Implement control and calibration of the CC2592.

This implements the control functions defined earlier and adds the
necessary logic for initialising the CC2592.

The transmit and receive power levels are also calibrated.

* [cc2538] Define CC2592 options in Makefile.

This allows building of a CC2538-CC2592 EM image by specifying
`CC2592=1` on the command line.
2019-02-22 08:59:19 -08:00
Piotr Szkotak 530a4d23ad [slaac] remove otIp6SlaacUpdate leftover from the ip6.h header (#3612) 2019-02-21 16:22:01 -08:00
Jonathan Hui 7ddeb2123f [mesh-forwarder] avoid assert when processing direct transmissions (#3614) 2019-02-20 18:10:51 -08:00
Jonathan Hui 84eb7493ca [mle] remove assert in Mle::FillConnectivityTlv() when detached (#3610) 2019-02-20 18:10:38 -08:00
mateusz- 2d6e9085f8 [doc] fix incorrect SNTP comment (#3613) 2019-02-20 09:47:40 -08:00
Abtin Keshavarzian 795a7e9197 [mbedtls] include debug.h (#3608)
The `<mbedtls/debug.h>` is included in `mbedtls.cpp` file which is
needed for `mbedtls_debug_set_threshold()`.
2019-02-19 20:47:05 -08:00
Jonathan Hui 87838428a0 [lowpan] try to compress fewer headers on compression errors (#3597) 2019-02-19 20:46:28 -08:00
Jonathan Hui d8d1d91422 [lowpan] indicate compress error when processing beyond msg buf (#3597) 2019-02-19 20:46:28 -08:00
Jonathan Hui 62e4c0a2e9 [lowpan] leave msg offset and buf writer unmodified on error (#3597) 2019-02-19 20:46:28 -08:00
Jonathan Hui 49641e1d4e [lowpan] introduce buffer writer to lowpan compressor (#3597) 2019-02-19 20:46:28 -08:00
Martin Turon 0f2502833e [nrf52840] add nrfjprog target for flashing (#3478) 2019-02-19 20:46:02 -08:00
Marven Gilhespie 18c496d915 [efr32] update to Silicon Labs Flex SDK v2.5 (#3596) 2019-02-19 12:09:49 -08:00
Łukasz Duda 9297f3559d [cli] allow to define ping interval in milliseconds (#3607) 2019-02-19 12:04:23 -08:00
Łukasz Duda 8c13df5a51 [cli] add command to retrieve mle counters (#3605) 2019-02-19 11:37:45 -08:00
hjian2017 403f7f8109 [cli] correct dataset examples in README (#3604) 2019-02-19 09:00:29 -08:00
Piotr Szkotak 697aa0259c [nrf52811] fix uart hwfc define in the platform config (#3606) 2019-02-19 08:54:57 -08:00
Piotr Szkotak 80c98ac824 [nrf528xx] update radio driver to version 1.3.0 (#3603) 2019-02-19 08:44:49 -08:00
Irving-cl cf7bc35bbe [tests] add traffic check in test case Cert_7_1_01 (#3405) 2019-02-18 13:41:30 -08:00
Łukasz Duda 968f9b6898 [nrf528xx] improve flash API (#3602) 2019-02-18 11:11:13 -08:00
Piotr Szkotak cb8761b7d0 [nrf528xx] update app_error_weak.c (#3601) 2019-02-18 11:10:56 -08:00
Abtin Keshavarzian b0110db4e5 [link-raw] remove the redundant logs in link-raw api (#3598) 2019-02-16 13:11:51 -08:00
Łukasz Duda 62d5be594d [nrf528xx] improve platform specific configs (#3595) 2019-02-15 09:34:28 -08:00
Łukasz Duda ab0d639ccb [doc] improve doxygen comments (#3594) 2019-02-15 09:29:48 -08:00
RaKu 905f8c7153 [nrf528xx] always enable diag module (#3593)
Disabling diag module causes linker errors due to unresolved symbols when building NCP example with NCP_SPI flag set to 1 on some toolchains.
2019-02-15 09:22:14 -08:00
Abtin Keshavarzian e02c970269 [mac] assert on failure of otPlatRadioEnable() (#3592) 2019-02-15 09:20:15 -08:00
Yakun Xu b08fab42bb [posix-app] fix aliasing issues in platform UDP (#3591) 2019-02-14 13:26:06 -08:00
Jonathan Hui 5ca9db0035 [style] remove snake case from style guide (#3586)
For better or worse, the existing C code style follows camel case. Rather
than changing the code, simply update the style guide.
2019-02-14 13:09:00 -08:00
Jonathan Hui 1627a42864 [mpl] fix bug in comparing sequence numbers (#3588)
Fix serial number arithmetic due to value wrap.
2019-02-14 11:33:39 -08:00
Łukasz Duda 6170948e27 [mpl] fix inserting mechanism and timer handling (#3587) 2019-02-14 08:54:18 -08:00
Yakun Xu 2f2aba80dd [platform-netif] disable icmp echo (#3590) 2019-02-13 21:37:54 -08:00
Abtin Keshavarzian 7a69ae36a1 [slaac] add config option to enable/disable SLAAC support (#3512)
This commit adds `OPENTHREAD_CONFIG_ENABLE_SLAAC` as a build
configuration option to enable/disable SLAAC support within
OpenThread. This feature is disabled by default. This commit also
adds `SLAAC` to `common-switches` list to allow builds to enable
this feature easily.
2019-02-13 18:17:18 -08:00
Krzysztof Bogucki 96de36385a [ip6] messages sent to Service Locator will not be filtered out (#3585)
Messages sent to Service Locator will not be filtered out, when thread
control traffic filtering is enabled via SetReceiveIp6FilterEnabled().
2019-02-13 08:59:33 -08:00
Yakun Xu 14d4d88727 [mbedtls] guard allocator with accurate macro (#3575)
This commit guards using mbedTLS's buffer allocator API with a more accurate
macro, so that even in single instance mode, we can use other memory
allocator.
2019-02-13 08:58:41 -08:00
Martin Turon c04bf5ea24 [ble] BLE API improvements: add l2cap and gatt services registration (#3563) 2019-02-13 08:57:13 -08:00
Jonathan Hui 038edf53b2 [mpl] allow multiple entries from the same Seed ID (#3557)
This commit improves MPL delivery performance by allowing a single Seed ID
to burst multiple MPL packets without suppressing previous transmissions.
2019-02-12 08:34:11 -08:00
Abtin Keshavarzian 445827108b [ip6] update documentation for otIp6ReceiveCallback (#3584) 2019-02-12 06:03:57 -08:00
Abtin Keshavarzian 778f99798e [notifier] enhance documentation (#3583) 2019-02-12 06:03:13 -08:00
Abtin Keshavarzian 490b5739a8 [toranj] add test-case for data poll transmission and poll interval (#3570) 2019-02-11 21:50:22 -08:00
Kamil Sroka 84a2706393 [build] don't define UINT32_MAX for C (#3581) 2019-02-11 13:04:56 -08:00
Yakun Xu 9bd0467b6f [posix-app] fix aliasing issue (#3579) 2019-02-11 13:03:26 -08:00
Yakun Xu cced005256 [posix-app] fix write in daemon mode (#3576)
In daemon mode, UART write should be processed even when no client
is connected. This commit writes UART to STDERR in such situation.

* add test for daemon mode
* remove useless code for UART restore
* fix a typo of assert
* set FD_CLOEXEC flag to better support reset.
2019-02-11 10:58:18 -08:00
Yakun Xu 0810ed6572 [posix-app] explictly set optind (#3574)
This allows another options parser before initializing OpenThread.
2019-02-11 10:54:03 -08:00
Łukasz Duda 9c2dba773e [nrf528xx] test all transport variants in CI (#3573) 2019-02-11 10:52:08 -08:00
Irving-cl 2ac8890c41 [tests] fix class name for Cert_9_2_04 (#3572) 2019-02-11 10:50:58 -08:00
Abtin Keshavarzian 4219b5bb04 [ncp] add static assert to check size of changed set entries array (#3571) 2019-02-11 10:50:20 -08:00
Abtin Keshavarzian 7494216415 [instance] update the documentation for Get<Type> definition (#3569) 2019-02-08 08:43:06 -08:00
Abtin Keshavarzian 3ba1c79910 [mac] use ot::Instance reference in scan callback handlers (#3568)
This commit changes the scan callback handlers to use `ot::Instance`
as a parameter replacing a given `void *` context.
2019-02-08 08:42:29 -08:00
Jonathan Hui 8a037c8aa5 [travis] add build checks for qpg6095 platform (#3567) 2019-02-08 08:41:47 -08:00
Łukasz Duda 070fd834e8 [nrf52811] add support for nRF52811 platform (#3566) 2019-02-08 08:41:22 -08:00
Jonathan Hui 46d0b62ec7 [travis] move platform builds to common functions (#3562) 2019-02-07 08:44:40 -08:00
RaKu bfe0c492d9 [nrf52840] disable compilation of unused transports (#3561)
Add DISABLE_TRANSPORTS switch which disables build of all transports and examples using them.
Disable compilation of USB and UART transports if NCP_SPI switch is set. This also disables
the build of CLI example.
2019-02-07 08:42:27 -08:00
Abtin Keshavarzian f01e3f34e5 [mac] always emit OT_CHANGED_THREAD_CHANNEL on channel change (#3560) 2019-02-06 08:42:53 -08:00
Abtin Keshavarzian f31f8c1f3c [link-raw] handle get/set channel when LinkRaw is enabled (#3559)
This commit updates `otLinkGetChannel()` and `otLinkSetChannel()`
to handle the situation where raw-link mode is enabled.
2019-02-06 08:42:37 -08:00
Abtin Keshavarzian bd4ca8113d [ncp] add support for getting MLE counters (#3558)
A new spinel property `SPINEL_PROP_CNTR_MLE_COUNTERS` is defined,
which can be used to get Thread MLE counters (`otMleCounters`).
2019-02-06 08:41:50 -08:00
Jonathan Hui 3070948ec5 [travis] enhance samr21 build checks (#3556)
- enable gcc 7 and 8 build checks
- upgrade to asf-standalone-archive-3.45.0.85
2019-02-06 08:40:54 -08:00
Abtin Keshavarzian d2e9bdfca3 [notifier] auto-register callback from its constructor (#3555)
This commit helps simplify the implementation and use of `Notifier`
by having the `Callback` constructor registering the callback with
the `Notifier`.
2019-02-04 21:51:41 -08:00
Abtin Keshavarzian ede320712e [mle] use IsAttached() to start border agent (#3554) 2019-02-04 21:08:11 -08:00
Abtin Keshavarzian ab871b5025 [mle] skip saving network info on role change to detached (#3553)
This commit changes the behavior of `Mle` to skip the saving of
network info (to non-volatile memory) on role change to detached. Note
that `Store()` does only update the MAC/MLE counters if device is not
attached. The MAC/MLE counters update is tracked already by
`KeyManager`.
2019-02-04 21:07:54 -08:00
Abtin Keshavarzian e990ede832 [settings] skip non-volatile save with same NetworkInfo/ParentInfo (#3552)
This commit adds new check in `settings.cpp` for saving of
`NetworkInfo` and `ParentInfo` in non-volatile memory to verify that
the new value is different from previously saved content. This reduces
number of writes after a device reboot.
2019-02-04 21:06:22 -08:00
Abtin Keshavarzian 7698c21020 [mle] use local ref to KeyManager/Mac/MleRouter for reused objects in methods (#3551) 2019-02-04 21:05:53 -08:00
Abtin Keshavarzian 29d637683f [settings-flash] ensure SETTINGS_CONFIG_PAGE_NUM >=2 (#3416)
This commit adds code to ensure `SETTINGS_CONFIG_PAGE_NUM` is at
least two. This helps simplify the code and also address
Coverity warnings for unreachable code.
2019-02-04 20:46:23 -08:00
Oleksandr Grytsov c31ab99080 [samr21] Define SETTINGS_CONFIG_PAGE_NAME with const (#3491)
Currently SETTINGS_CONFIG_PAGE_NAME is defined indirectly by addresses of
__d_nv_mem_start and __d_nv_mem_end. But such definition doesn't allow to
perform compile time sanity check. Define this macro with const value 16.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov e7a6bde56d [samr21] Implement otPlatLog for SAMR21 XPLAINED PRO board (#3491)
Use EDBG DGI SPI interface to put log.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov 513b0f8b8d [samr21] Pass ack frame to otPlatRadioTxDone (#3491)
SAMR21 RF doesn't provide ACK frame payload. Create it manually and pass to
otPlatRadioTxDone.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov cf7b57a5cf [samr21] Set RF state to OT_RADIO_STATE_RECEIVE on tx finished (#3491)
OT doesn't always call otPlatRadioReceive to set rx state explicitly. It
causes RF is in wrong state in some cases. SAMR21 RF is switched to
rx state internally when tx is finished and OT platform radio state should
be updated accordingly. This fix is set sState to OT_RADIO_STATE_RECEIVE
when tx is done.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov f304177726 [samr21] Add hardware acceleration for the AES block cipher (#3491)
samr21 has HW aes-128 module. It couldn't be used before as mbedtls uses
256 bit random generator. Recently mbedtls introduces
MBEDTLS_CTR_DRBG_USE_128_BIT_KEY flag which makes mbedtls to use 128 bit
random generator. It limits the security of generated keys but allows
to use HW aes-128 module for encrypt/decrypt 802.15.4 frames.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov 0073a49dbd [samr21] Update README.md to latest ASF 3.45.0 (#3491)
* update reference to ASF 3.45.0 and gcc 7.3.1
* update other links

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov c4a7e8570d [samr21] Add possibility to define board with command line (#3491)
By default Makefile-samr21 builds for SAM R21 Xplained Pro board. Another
board can be specified with BOARD variable through command line:

    make -f examples/Makefile-samr21 BOARD=<TARGET_BOARD>

Currently supported following boards: SAMR21_XPLAINED_PRO,
SAMR21G18_MODULE, SAMR21B18_MODULE.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov 9fee87c071 [samr21] Remove memcpy from otPlatRadioTransmit (#3491)
samr21 rf driver requires that first byte of transmit buffer should be
psdu length. The psdu was copied to a local buffer with one byte shift then
the local buffer was passed to rf driver. This copying is removed by
extending length of sTransmitPsdu by 1 byte and use &sTransmitPsdu[1] as
transmit frame psdu.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Oleksandr Grytsov 68d527a530 [samr21] Fix compilation issue with gcc 7.3.1 (#3491)
Internal compiler.h defines __always_inline macro and includes cdefs.h
indirectly. cdefs.h also defines this macro. As result we have redefined
macro error which can't be suppressed. The fix is to use custom compiler.h
which is copy of ASF compiler.h bu defines __always_inline only if it is
not yet defined.

Signed-off-by: Oleksandr Grytsov <al1img@gmail.com>
2019-02-04 18:24:37 -08:00
Jeffrey Hayes 2c866feb48 [efr32] random number generation fix (#3367) 2019-02-04 15:59:18 -08:00
Markov Vladislav 28cf269481 [topology] add static assertion to exclude counter overflow (#3550) 2019-02-04 10:53:09 -08:00
Jonathan Hui 362f97df1e [fuzz] return valid radio transmit buffer (#3549) 2019-02-04 10:52:00 -08:00
Jonathan Hui 404d946150 [cli] validate ping interval is positive to avoid Timer::Start() assert (#3548) 2019-02-04 10:51:45 -08:00
Jonathan Hui b2bbad7674 [ncp] disable assert and watchdog property when fuzz testing (#3547) 2019-02-04 10:51:31 -08:00
erja-gp 392cfecff8 [qpg6095] add Qorvo QPG6095 platform (#3525) 2019-02-04 10:50:27 -08:00
Yakun Xu b79d5d6a92 [toranj] allow specifying wpantund path (#3544) 2019-02-01 22:13:25 -08:00
Yakun Xu 69aa5c4f04 [posix-app] add daemon mode (#3463)
This commit adds the daemon mode for POSIX CLI app. The daemon simply
receive UART input from a unix socket connection.
2019-02-01 22:05:59 -08:00
Yakun Xu e68e86317e [ci] test with time sync and header ie (#3514)
This commit adds the missing test with ie present by enabling TIME_SYNC
feature, so that IE code are covered.
2019-02-01 16:08:43 -08:00
Yakun Xu db67b3a980 [posix] fix build for SPI bus (#3546) 2019-02-01 10:01:41 -08:00
Łukasz Duda 66476070a5 [toolchain] define __COUNTER__ for keil compiler (#3545) 2019-02-01 09:26:33 -08:00
Jonathan Hui ac89fd5496 [style] return void where code always returns OT_ERROR_NONE (#3543) 2019-02-01 09:03:24 -08:00
Abtin Keshavarzian c7911adcb1 [mle] remove unused attach state kAttachStateSynchronize (#3542)
The attach state `kAttachStateSynchronize` was intended for sending
"Child Update Requests" after a reset (if device was previously
attached) using the `mAttachTimer` for retransmissions. However,
"Child Update" transmissions use `mMessageTransmissionTimer`
instead.
2019-02-01 09:03:10 -08:00
Yakun Xu 5b4e7f9331 [diag] check buffer size definition (#3541) 2019-01-31 13:04:46 -08:00
Abtin Keshavarzian 57e2f4e26d [mle] stop attach timer from SetStateChild() (#3538)
This commit changes `SetStateChild()` to stop `mAttachTimer`. This
ensures that as the `mAttachState` is set to idle, the attach timer is
also stopped (note that the attach timer callback asserts on idle
attach state). This addresses a rare issue where an inopportune device
mode change request on an already attached device while it is
performing periodic parent search (or possibly delaying processing of
a received announce) could cause an assert; `SetDeviceMode()` would
call `SetStateChild()` setting the attach state to idle while attach
timer would continue to run.
2019-01-31 13:03:02 -08:00
Abtin Keshavarzian 987ff3c017 [mle] change SetStateDetached()/SetStateChild() to be void (no return) (#3539) 2019-01-31 08:50:07 -08:00
Abtin Keshavarzian bd41c63a0a [mle] remove redundant mAttachTimer stop (#3537)
The call to `SetStateDetached()` will stop the attach timer.
2019-01-31 08:49:13 -08:00
Jonathan Hui 0e8967f5ed [fuzz] disable HDLC FCS check during fuzz tests (#3536) 2019-01-31 08:48:44 -08:00
Yakun Xu 8dcdc2cf31 [meshcop] border agent of native commissioner (#3535)
This commit enables a node serve as the border agent of native commissioner
by adding the border agent UDP port to unsecure port when the security
policy allows.

To fully test verify this commit, we need a native commissioner, which I
will submit a separate commit to enable that.
2019-01-31 08:48:27 -08:00
Jonathan Hui da12dca4d9 [cli] fix arg count checks in dataset command (#3533) 2019-01-30 08:47:53 -08:00
Jonathan Hui ba9709b674 [dtls] simplify dtls state machine (#3529)
This commit also adds checks to ensure there is only one outstanding
connection at a time.
2019-01-30 08:47:42 -08:00
Abtin Keshavarzian f9d757a161 [router-table] fix allocated router ids bit-vector size (#3534) 2019-01-29 19:09:25 -08:00
Abtin Keshavarzian 144270105d [router-table] add new methods to help iterate over router entries (#3527) 2019-01-29 12:12:56 -08:00
Abtin Keshavarzian e71bd6267e [test] fix PRETTY_FILES definition in unit test makefile (#3532)
The `test_string` source is also made "pretty".
2019-01-29 11:55:16 -08:00
Jonathan Hui 1c2e7033bf [cli] fix ping interval bounds check to avoid Timer::Start() assert (#3531) 2019-01-29 11:54:38 -08:00
Jonathan Hui 96076d3aa4 [coap] process Option Length = 0xf as a format error (#3530) 2019-01-29 08:55:59 -08:00
Jeff Bumgardner 3101ba7f0e [docs] Update README logo soup (#3528) 2019-01-29 08:54:50 -08:00
Yakun Xu 15d1603639 [build] clean up switches for POSIX platform (#3517) 2019-01-29 08:54:09 -08:00
Yakun Xu 504331eadd [mac] remove mDidTx from otRadioFrame (#3520)
mDidTx indicates whether a frame is received or transmitted, which is
only useful for capturing packets. This commit removes this field, and makes
this flag an argument to the pcap callback.
2019-01-28 12:31:15 -08:00
Yakun Xu 7789b90f23 [android] add missing OPENTHREAD_ENABLE_POSIX_APP (#3519) 2019-01-28 11:28:29 -08:00
Jiacheng Guo e893db15b5 [build] add platform udp build switch (#3450) 2019-01-28 10:43:34 -08:00
Yakun Xu 2146acbb18 [coap] make CoapBase::Send() private (#3526)
This commit makes `CoapBase::Send()` private so that only safe methods
are exposed, such as `SendMessage()`, `SendEmptyMessage()`, `SendAck()`.
2019-01-28 08:52:19 -08:00
rongli 47be103a62 [thci] update routerselectionjitter before start thread (#3524) 2019-01-28 08:41:14 -08:00
Jonathan Hui 251207d725 [cli] add lower bounds check to channel selection (#3523) 2019-01-28 08:39:18 -08:00
Jonathan Hui 70cb48f17a [ncp] resolve undefined shift in BorderRouterConfigToFlagByte (#3522) 2019-01-28 08:39:02 -08:00
Jonathan Hui f9659b3733 [router-table] add arg bounds check to Release() (#3521) 2019-01-28 08:38:42 -08:00
Jonathan Hui cb5e076a3e [cli] add length checks for "coaps set psk" (#3518) 2019-01-25 15:36:50 -08:00
Jonathan Hui cc26f1418e [network-data] resolve undefined shift in SetPreference() (#3503) 2019-01-25 15:10:26 -08:00
wgtdkp e341d02876 [meshcop] set message offset when sending JOIN_FIN.rsp (#3516) 2019-01-25 10:07:59 -08:00
Kamil Sroka eb4e460f9f [nordic] update nrfx to 1.6.0 (#3515) 2019-01-25 08:40:42 -08:00
Abtin Keshavarzian 6d0bce85a0 [thread-netif] change Up()/Down() to void (no return) (#3513) 2019-01-25 08:37:59 -08:00
Abtin Keshavarzian f13e35d5f7 [mesh-forwarder] change Start() and Stop() to be void (no error return) (#3509) 2019-01-25 08:36:30 -08:00
Jonathan Hui 249bc59874 [cli] add length check for "service add" (#3508) 2019-01-25 08:36:06 -08:00
Jonathan Hui 993f537a03 [cli] add ping interval bounds check to avoid Timer::Start() assert (#3507) 2019-01-25 08:35:44 -08:00
Jonathan Hui 560d9350b2 [emsk] set SETTINGS_CONFIG_PAGE_NUM = 2 (#3510) 2019-01-24 18:20:27 -08:00
Yakun Xu 5777e017ac [cli] refine CLI APIs (#3501) 2019-01-24 18:19:50 -08:00
Abtin Keshavarzian 0ac326ea57 [mac] update "out of band tx" to check current operation state (#3461)
This commit changes the `SendOutOfBandFrameRequest()` implementation
to check `mOperation` and `mPending<>` state variables to determine
if MAC layer is still busy with a previous OOB tx request (instead of
using the `mOobFrame` pointer variable). This change makes the OOB tx
implementation behave similarly to other APIs (e.g., `ActiveScan()`
or `SendFrameRequest()`). This commit also enhances the documentation
for the OOB Send APIs in header files.
2019-01-24 13:56:19 -08:00
Jonathan Hui b431bc34ce [network-data] avoid overflow in Service TLV length computation (#3506) 2019-01-24 09:06:36 -08:00
Jonathan Hui ce3c712fe6 [cli] validate prefix add/remove argument count (#3505) 2019-01-24 09:04:38 -08:00
Jonathan Hui c2a10ec446 [ip6] only allow external mcast addrs when iface is up (#3504) 2019-01-24 09:04:13 -08:00
Yakun Xu eeff2e225c [cli] move output format to server (#3502) 2019-01-24 09:02:23 -08:00
Jonathan Hui 65db853abc [nrf52840] fix build with DISABLE_BUILTIN_MBEDTLS=1 (#3497) 2019-01-24 09:01:11 -08:00
Jonathan Hui 4ca58d440d [cli-uart] save space for NULL terminator in rx buffer (#3500) 2019-01-23 21:50:56 -08:00
Jonathan Hui aa5673cd48 [cli] add bounds check on channel selection (#3499) 2019-01-23 21:50:38 -08:00
Yakun Xu 9094c12652 [code] add static assert (#3422) 2019-01-23 21:50:19 -08:00
Jonathan Hui a00c538830 [network-data] add prefix length checks (#3498) 2019-01-23 21:49:37 -08:00
Jeff Bumgardner 4bc819c307 [docs] Doxygen tag updates (#3496) 2019-01-23 14:28:40 -08:00
Jonathan Hui 0cc913b6b5 [network-data] add length checks to insert operations (#3495) 2019-01-23 10:16:48 -08:00
Yakun Xu 612d9de236 [posix] fix diagnostics for missing diag alarm (#3494)
This commit fixes a bug that `alarm.c` misses definition of
OPENTHREAD_ENABLE_DIAG for not including `openthread-core-config.h`.
This commit adds the `openthread-core-config.h` to every platform sources.

Also, this commit enhances the `test_diag.py` to make sure diag can send
packets out.
2019-01-23 08:49:27 -08:00
Jonathan Hui 2a14819996 [coap] return error if CoAP options exceeds message length (#3493) 2019-01-23 08:47:48 -08:00
Jonathan Hui 0c487ef140 [mle] do not add ip6 addrs in disabled state (#3492) 2019-01-23 08:47:31 -08:00
Yakun Xu d8c17ceef2 [posix-app] expose mainloop APIs (#3490) 2019-01-23 08:46:33 -08:00
Abtin Keshavarzian dde12296e5 [mac-frame] change const methods to return pointers to const (#3481)
This commit changes the `const` methods in `Mac::Frame` class
returning a pointer type to return a pointer to `const`. It also
changes the implementation of non-`const` methods (e.g., `GetPayload()`
and `GetFooter()`) to re-use the corresponding `const` methods.
2019-01-23 08:43:30 -08:00
Yakun Xu 3fabc4660c [slaac] handle slaac internally (#3484) 2019-01-22 23:34:26 -08:00
Yakun Xu 26c5d0ecb8 [border-agent] reuse Dtls restart (#3489)
`MeshCoP::Dtls` session will restart listening by itself. It's not
necessary for border agent to restart `MeshCoP::Dtls`.
2019-01-22 16:11:07 -08:00
Yakun Xu fe3d910853 [doc] add missing doc for datatset (#3487) 2019-01-22 16:08:33 -08:00
Robert Lubos 9cb48245e5 [cli] fix GetOwner function for console cli backend (#3486)
Current implementation of GetOwner function for single-instance CLI
assumed that `cli_uart` backend is used. This caused application
crash when different backend was used and `cli_uart` was not
initialized (and in result sUartServer static pointer was not set).

This commit fixes the issue by moving static CLI Server pointer and
the mInterpreter field to the to the base Server class and providing
getter method to obtain the Interpreter instance. With this approach,
any backend derived from the Server class will be able to initialize
the static pointer and will provide a valid reference to the
Interpreter class instance.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-22 16:07:46 -08:00
Yakun Xu b1686c61f4 [slaac] only create a single address for a prefix (#3485)
This commit changes the SLAAC policy so that if there is an existing address
with of a prefix, no new address will be created for this SLAAC enabled
prefix.
2019-01-22 09:15:02 -08:00
Abtin Keshavarzian 72aa8d0b3e [router-table] reuse const method GetRouter() in related non-const version (#3483) 2019-01-22 09:13:24 -08:00
Jonathan Hui f9eb4cb517 [fuzz] add CLI UART input to fuzz tests (#3482) 2019-01-22 09:07:13 -08:00
Jonathan Hui 061e54627c [cli] rename cli_udp_example to cli_udp (#3480) 2019-01-22 09:06:10 -08:00
Abtin Keshavarzian 5e50914f1f [mle] simplify Start() (#3472)
This commit simplifies the `Mle::Start()` by combining its parameters.
With the new definition `Start()` would always try to reattach using
any saved active/pending dataset unless it is asked to attach on an
announced network (i.e., `aAnnounceAttach` is `true`).
2019-01-22 09:05:50 -08:00
Yakun Xu f40f49ff32 [dhcp] remove dhcp server api (#3476) 2019-01-18 11:34:40 -08:00
Yakun Xu 820d231067 [cli] cleanup dataset implementation (#3474) 2019-01-18 11:32:36 -08:00
Jonathan Hui f4c10c0ae1 [cli] cleanup CoAP example (#3470) 2019-01-18 11:30:32 -08:00
Yakun Xu d57b747c98 [udp] expose UDP receiver API (#3477) 2019-01-18 06:50:39 -08:00
Yakun Xu 8112a6376f [cli] remove cli udp (#3473) 2019-01-18 06:08:52 -08:00
Abtin Keshavarzian d393f08b6f [ncp-base] define ResponseType for queued spinel response entries (#3471) 2019-01-18 06:05:13 -08:00
Zhanglong Xia eb7a910638 [efr32] add support for OQPSK modulation in 915MHz band (#3315) 2019-01-18 05:43:51 -08:00
Jonathan Hui b25e0bb4c8 [coap] add NULL check in Message::Clone() (#3469) 2019-01-17 07:33:02 -08:00
Yakun Xu e45107dac7 [code-utils] fix wrong pointer size in otALIGN (#3468) 2019-01-17 02:59:32 -08:00
Yakun Xu 16c904955a [test] fix on macOS (#3467) 2019-01-17 02:58:35 -08:00
Yakun Xu 0ace247e41 [android] disable warning no virtual destructor (#3466)
Change-Id: Ib1e28d064886af3cc5103395c284d772b3c85504
2019-01-17 02:54:43 -08:00
Jonathan Hui 15b6bf316b [travis] add arm gcc 8 to build tests (#3465) 2019-01-17 02:53:12 -08:00
Jonathan Hui b268171278 [coap] change assert to avoid index out-of-bounds warning (#3464) 2019-01-17 02:52:37 -08:00
Jonathan Hui 28582ef038 [coap] return error if CoAP header exceeds message length (#3462) 2019-01-16 05:57:02 -08:00
Kamil Sroka 57a0fda5da [sntp] fix Keil build with SNTP_CLIENT=1 (#3460) 2019-01-16 00:17:32 -08:00
Jonathan Hui 803168cf5a [spinel] add bounds checks when decoding uint (#3459) 2019-01-16 00:16:58 -08:00
Jonathan Hui 107a4a2b43 [docker] add wpantund and toranj support (#3454) 2019-01-16 00:16:38 -08:00
Abtin Keshavarzian a8010052bb [spinel] add documentation for spinel properties (#3446) 2019-01-16 00:16:23 -08:00
Yakun Xu 4245f6c420 [coap] refine CoAP classes (#3434)
Currently Coap::Receive and CoapSecure::Receive process different
messages. The former CoAP payload, while the latter DTLS payload.
This commit tries to reduce the confusion so that Coap*::Receive always
processes CoAP messages, just like Coap*::Send. With this commit,
CoapBase handles pure CoAP messages without knowledge of the
underlying transport. And the transport layer can also do its job without
processing CoAP message.

Also, this commit also removes virtual methods from Coap::*.

And here are the changes:

* UdpSocket is moved into sub-classes instead of the base class.
* CoapBase::Receive is now non-virtual method.
* CaopBase::Send is now non-virtual method, replaced by a function
pointer of sub-class of CoapBase.

And the new class relationship is as follows:

```
CoAP layer:              CoapBase
                           / \
                          /   \
                         /     \
Transport Layer:      Coap  CoapSecure

```
2019-01-16 00:15:51 -08:00
Yakun Xu 5eee323b8d [coap] process CoAP header in message (#3419)
This commit refines Coap::Header into Coap::Message to avoid declaring
the big Coap::Header in stack which was causing problems in low-memory
systems such as CC2538.

A UDP reserves 56 bytes by default, which will not be used before an
outbound message goes down to transport layer and after an inbound
message is delievered to CoAP agent. To get better performance, this commit
utilizes these reserved bytes of cache basic header of CoAP message
including CoAP version, code, message ID and token. These cached data
are parsed when CoAP agent receives a CoAP message and are dumped into
the correct place of a CoAP Message before sending by lower layer.

To make sure there is enough reserved bytes for an inbound message, This
commit removes headers in UDP layer before delivering a ot::Message to
handlers.
2019-01-15 05:00:21 -08:00
Jiacheng Guo 1f6d7c8b3b [uart] add lock interface for uart (#3380) 2019-01-15 01:28:33 -08:00
Yakun Xu 0f4bae97e9 [message] add const to read APIs (#3458) 2019-01-14 13:53:20 -08:00
Jonathan Hui 64e62a5314 [fuzz] add NCP UART input to fuzz tests (#3456) 2019-01-14 13:52:17 -08:00
Abtin Keshavarzian 59385b188b [network-data] use enumeration Type for local vs leader (#3455)
This commit changes `NetworkData` to use an enumeration `Type` to
specify whether a `NetworkData` instance represents local network
data or leader network data.
2019-01-14 13:51:50 -08:00
Abtin Keshavarzian 2057a141ef [router-table] rename loop variables in UpdateAllocation() (#3453) 2019-01-11 09:03:42 -08:00
Jonathan Hui 1056c7c93a [style] fix typos (#3451) 2019-01-11 09:03:10 -08:00
Irving-cl f5c49e2dd0 [tests] fix mac key id mode parsing (#3448) 2019-01-11 09:02:52 -08:00
Łukasz Duda 880ecfd749 [docs] fix invalid TODO comment (#3452) 2019-01-10 13:49:12 -08:00
wacmac 103a9db541 [harness-automation] update device category (#3449) 2019-01-10 08:55:39 -08:00
Piotr Szkotak cc0bcd3d68 [nrf52840] do not include libjlinkrtt in the SDK version of OT libs (#3445)
Signed-off-by: Szkotak, Piotr <Piotr.Szkotak@nordicsemi.no>
2019-01-09 15:49:47 -08:00
mateusz- 6d30288d77 [dtls] handle MBEDTLS_ERR_SSL_WANT_READ during send (#3444) 2019-01-09 15:48:50 -08:00
Kamil Sroka 8c793427a3 [nrf52840] fix build with COAPS=1 and SNTP_CLIENT=1 (#3440) 2019-01-09 14:33:58 -08:00
Abtin Keshavarzian a2a9d6502e [mac] simplify the check for frame pending in data request ack (#3438) 2019-01-09 14:33:22 -08:00
Jonathan Hui b6065c0fc1 [dhcp6] use EUI-64 in Client and Server Identifier (#3443) 2019-01-09 09:50:35 -08:00
Abtin Keshavarzian bf48a647b3 [mac] stop timer on pending WaitingForData operation on rx-on-idle change (#3437)
This commit changes `SetRxOnWhenIdle()` to stop the timer (data poll
timeout) if there is a pending `kOperationWaitingForData` when rx-on-
when-idle is being enabled. This addresses an issue where the timer
could remain active if the `SetRxOnwhenIdle(true)` is called before
the operation `kOperationWaitingForData` actually starts. Note that
the data poll timeout timer gets started while current operation is
`kOperationTransmitData` (from `HandleTransmitDone()` on a successful
data request frame transmission with a received ack indicating a
pending frame).
2019-01-09 09:43:51 -08:00
Yakun Xu eb8c6d90bd [diag] quick fix to support long output (#3436)
`Cli::Uart::OutputFormat()` current only supports output
`OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH` bytes, which isn't enough
for command *diag* by default. This PR removes that restriction
by using `Cli::Uart::Output`.

I think this is just a quick fix, an overall enhancement of Cli is
needed so that we can use small stack size but also get better
performance.
2019-01-09 09:43:14 -08:00
Yakun Xu 3018886993 [windows] fix warnings (#3435) 2019-01-07 09:04:50 -08:00
Jonathan Hui dfd2b9b032 [api] fix typos (#3431) 2019-01-07 09:03:55 -08:00
Yakun Xu a42efee470 [script] add script to run cert tests (#3397) 2019-01-07 09:03:36 -08:00
Kamil Sroka 1b4d05ee37 [nrf52840] increase max children count (#3433) 2019-01-04 08:47:28 -08:00
Kamil Sroka 979b50522d [nrf52840] update nRF52840 radio driver to version 1.2.3 (#3432) 2019-01-04 08:45:41 -08:00
Jonathan Hui 7554e344ce [test-driver] update README.md format (#3430) 2019-01-04 08:42:03 -08:00
Jonathan Hui e2056e0927 [nlbuild-autotools] update to 1.6.5 (#3429) 2019-01-04 08:41:38 -08:00
Jonathan Hui 84cb1e0d14 Merge commit '978a3f4d0664c483dbcf93a176353e4cb5f93aea' into nlbuild-autotools 2019-01-03 19:00:11 +00:00
Jonathan Hui 978a3f4d06 Squashed 'third_party/nlbuild-autotools/repo/' changes from ac728423..75faaf5f
75faaf5f Addressed an issue in which the failure to make the 'repos-warning' target order-only caused dependent repo paths to be repeatedly and unnecessarily remade which, in turn, caused git operations and the configuration or build to fail.
1d4fff8c Merge pull request #16 from nestlabs/feature/repos-with-clone
7233d998 Added support for pulling down remote package dependencies using git clone (default) or git submodule depending on the setting of pull.method in repos.conf.
1debcf62 Added support for coverage-local and check-local targets.
4699860c Merge pull request #15 from nestlabs/feature/check-coverage-local
79923820 Added support for coverage-local and check-local targets. Added documentation for all coverage-related targets.
d46f42a9 Addressed a spelling typo identified during code review.
b6a6c1ac Take a different approach to version flapping against 'make distcheck' by leaving VERSION_FILE as an immediate (:=) variable and instead creating a two-level <PACKAGE>_VERSION variable, the first of which is set from VERSION_FILE by default at make recursion level zero (0).
bf97ef6e Address an issue with VERSION_FILE on clean source code control clones or unarchived distribution in which 'make dist' or 'make distcheck' fail. VERSION_FILE should be and is intentionally a deferred (=) rather than an immediate (:=) variable to ensure late evaluation AFTER .local-version MAY be created rather than when the makefile containing it is parsed.
ae96d615 Fixed a typo.
74c4da2c Added support to repos.conf for a 'commit' key such that a hash or tag other than HEAD for a given repository and branch may be synchronized and checked out.
0d8afe93 When the verbose flag is asserted, prnt out the actual series of action commands that will be invoked.
8663c890 * Address a number of issues with building the prepackaged GNU   autotools subset included in nlbuild-autotools for Ubuntu   Bionic.
f2cdbac1 Add support, if necessary, for patching an expanded package.
35a238ed Only attempt to remove libtoolize if the effective user id matches that of the user executing the script.
7a899e8f Update the default version and change log for 1.5.2 and related changes.
48564b57 Since the '--name-only' option only appears in git-2.6 and later and there are production systems using git version as old as git-1.9, do not use '--name-only'.
7479acdf Fix a comment typo.
6c647b1d White space consistency clean-up.
60f989ea Incorporated a formatting suggestion from code review.
638a0c08 Fixed a typo.
33e0c7fc Addressed a number of typos and grammatical errors in comments and help output.
412d0e50 Fixed a typo.
4063134b Merge branch 'master' of github.com:nestlabs/nlbuild-autotools
4946bd54 Updated the date for 1.5.0.
90743059 Added a populate command for 'repos.conf'.
9bbf84f5 Added boilerplate examples for remote repository integration that package integrators can uncomment, adapt, or delete.
7418afd3 Initial revision.
0f9f1217 Ensure 'rm' explicitly includes -f should 'MAKEFLAGS' with '-R' be asserted in the environment.
2e6471f9 Add another clarifying example of building package-local tools from an integrated project.
bad99a91 Added content for and updated default version to 1.5.0.
b556c134 Added support for pulling down remote package dependencies using git submodule.
b9c6ca41 Restore prior change introduced at b07c9c034bc039f41336f447b55a4640c466d2bc.
e05e4fc4 Added a populate command to add 'Makefile-bootstrap' to the project top-level directory.
8ba67ce3 Added a populate command to add 'Makefile-bootstrap' to the project top-level directory.

git-subtree-dir: third_party/nlbuild-autotools/repo
git-subtree-split: 75faaf5f7b87cdd15c5d78ec61e8327e551a2a79
2019-01-03 18:54:49 +00:00
Kamil Sroka 380be9610c [nrf52840] fix build with IAR (#3428) 2019-01-03 10:27:38 -08:00
Jonathan Hui 27aecfec5b [posix-app] resolve "implicit conversion changes" warnings (#3426) 2019-01-03 09:20:15 -08:00
Abtin Keshavarzian ba1d46035b [mac] post operation task on rx-on-idle mode change (#3425)
The `SetRxOnWhenIdle()` is changed such that if it needs to stop
operation `WaitingForData`, the next operation gets started from
the `mOperationTask` tasklet. This change makes the behavior of
the `SetRxOnWhenIdle()`  consistent with other MAC APIs (i.e.,
new operations are started only from tasklet or from a radio/timer
callback and not from any MAC APIs). This commit also updates the
`HandleTimer()` to check for operation being `kOperationIdle` when
timer is used for delaying sleep.
2019-01-03 09:19:50 -08:00
Jonathan Hui 0cd21d8d3f [border-agent] check if TLV is valid after reading (#3424) 2019-01-03 09:16:54 -08:00
Zhanglong Xia 0e42d0b8c9 [mac] remove redundant checks (#3408) 2019-01-03 09:16:04 -08:00
Yakun Xu 2a9f8797f7 [posix-app] integrate with platform network interface (#3180) 2019-01-03 09:13:29 -08:00
Yakun Xu ae2b01947d [android] disable UART echo (#3421) 2019-01-02 10:34:46 -08:00
Abtin Keshavarzian 42c46368f1 [docs] fix typos in comments (#3417) 2019-01-02 10:24:08 -08:00
Abtin Keshavarzian 49945221dd [ncp-base] add IgnoreReturnValue when error should be ignored (#3415)
This change adds `IgnoreReturnValue` when the returned error can be
safely ignored. This should help address a Coverity warning.
2019-01-02 09:04:42 -08:00
Abtin Keshavarzian 041c14080a [core] use 1UL instead of 1U when working with uint32_t (#3411)
This commit replaces `1U` constants with `1UL` in bit shift
statements like `1U << shift` when dealing with a variable shift
value that can be larger than 15. This helps make it explicit to the
complier that the constant should be considered as a `uint32_t`.
2019-01-02 09:03:52 -08:00
Abtin Keshavarzian 3a6c5de3da [mle] avoid "1U << 32" when calculating attach start delay backoff (#3410)
This change avoids the use of (potentially) undefined "1U << 32"
when calculating the backoff delay for attach re-attempt in MLE.
Credit for this bug goes to Coverity.
2019-01-02 09:02:40 -08:00
Yakun Xu cdf0b7785d [mbedtls] free mbedtls on initialization failure (#3409) 2019-01-02 09:01:39 -08:00
Jiacheng Guo 08bb4ace81 [posix-app] do nothing if select interrupted with no available fds (#3406) 2019-01-02 08:59:52 -08:00
Yakun Xu e0c802569e [meshcop] correct UDP_PROXY in script and doc (#3420) 2018-12-29 12:45:41 -08:00
wgtdkp 3f6d50a728 [tests] enhance Cert_7_1_03_BorderRouterAsLeader (#3399) 2018-12-29 11:25:39 -08:00
Irving-cl d34f279e5a [tests] enhance Cert_6_1_02_REEDAttach_MED/SED (#3387) 2018-12-29 09:50:12 -08:00
Jonathan Hui 08247dc92f [message] avoid length overflow in SetLength() (#3418)
Credit to OSS-Fuzz.
2018-12-28 17:27:25 -08:00
Abtin Keshavarzian 4b1070444d [border-agent] check read UdpEncapsulationTlv length (#3414)
This commit verifies that the read length of `UdpEncapsulationTlv`
from a message is valid before processing it. Credit to Coverity.
2018-12-28 17:12:09 -08:00
Abtin Keshavarzian aabcd38db5 [socket] use "this" pointer in memset while initialization SockAddr (#3413)
This change helps address a coverity warning (about memory overrun).
2018-12-28 17:11:44 -08:00
Abtin Keshavarzian e5947b5e23 [udp6] init member variable from constructor (#3412)
This commit initializes `mUdpForwarder` and `mUdpForwarderContext`
from `Udp::Udp` class constructor. Credit to coverity.
2018-12-28 17:11:24 -08:00
Yakun Xu 97ace18c17 [udp] call at most one handler (#3398) 2018-12-28 17:09:19 -08:00
rongli 328239878d [data-poll-manager] check user-specified poll period (#3401) 2018-12-27 22:35:57 -08:00
Abtin Keshavarzian 3fb736c566 [ncp-base] limit legacy related member variable definitions to FTD/MTD builds (#3407)
This commit moves the definition of legacy related member variable
in `NcpBase` into a `#if OPENTHREAD_MTD || OPENTHREAD_FTD` block.
This addresses Coverity warning for un-initialized member variables
from constructor.
2018-12-27 16:30:32 -08:00
Jiacheng Guo 0fbb0e6310 [posix-app] enhance build switches (#3404) 2018-12-27 15:59:55 -08:00
Yakun Xu 99c753a6ad [message] allocate message with corresponding component (#3403) 2018-12-27 15:55:16 -08:00
Jiacheng Guo 0e31b0d617 [nrf52840] allow change state handler config in command line (#3402) 2018-12-27 15:51:15 -08:00
Jonathan Hui 4ababdce2d [bootstrap] install arm gcc toolchain on Raspbian (#3392) 2018-12-27 15:44:26 -08:00
Jing eca3e81fd3 [thci] update pollperiod command to accept ms resolution configuration (#3361) 2018-12-27 15:39:46 -08:00
Abtin Keshavarzian 7dc645a856 [hdlc] report frames smaller than FCS size as error frame (#3395)
This commit changes the `Hdlc::Decoder` implementation to report
non-zero length received frames shorter than FCS size as an error
`OT_ERROR_PARSE` (instead of ignoring such frames during decoding).
Since the recent changes in `Hdlc::Decoder` buffer model delegates
the management of the frame buffer to the user of `Decoder`,
clearing frame buffer after an error should be be performed by the
`Decoder` user from the `FrameHandler` callback. The change in this
commit addresses an issue where a small (single-byte) frame would
not have been cleared from the decoder buffer and included in the
next frame. This commit also updates the `test_hdlc` unit test to
cover small frame error.
2018-12-24 15:12:16 -08:00
Jiacheng Guo 52c06c6858 [build] option to disable executable build (#3391) 2018-12-24 15:10:30 -08:00
wgtdkp 35eaaab653 [tests] enhance Cert_5_1_06_RemoveRouterId (#3379) 2018-12-24 15:08:47 -08:00
Abtin Keshavarzian 3108b6a615 [posix-app] discard received HDLC frame on error (#3394)
This commit changes the `HdlcInterface::HandleHdlcFrame()` callback
which handles a received and decoded HDLC frame such that it
discards a bad/incorrect frame from the multi frame buffer (i.e,
discard the frame on any error).
2018-12-22 08:39:39 -08:00
Yakun Xu f2e3555a2a [posix-app] simplify UART on POSIX app (#3384) 2018-12-21 14:35:24 -08:00
Abtin Keshavarzian 34004c2c57 [posix-app] adopt new HDLC buffer models (#3371)
This commit updates the `HdlcInterface` and `RadioSpinel` to use the
new HDLC buffer model. In particular, for received spinel frames the
decoder uses an `Hdlc::MultiFrameBuffer` which is capable of storing
multiple frames in a FIFO queue manner.

With this model, the received and decoded spinel frames are directly
placed in the FIFO buffer. This allows `RadioSpinel` code during
`WaitResponse()` (when waiting for specific Spinel response frame) to
simply save/keep a notification frame in the queue buffer (without
requiring to copy the frame) so that it can read and process the
saved frame later. If a received frame can be processed at the time,
the frame is then simply discarded from the queue buffer.
2018-12-21 14:33:35 -08:00
Abtin Keshavarzian e96cc1b367 [hdlc] update buffer model for Encoder and Decoder (#3371)
This commit updates HDLC implementation to harmonize the buffer model
used by `Hdlc::Encoder` and `Hdlc::Decoder`.

The new model defines a common class `Hdlc::FrameWritePointer` which
provides a minimum set of APIs used by `Encoder/Decoder` for writing
frames, while not defining the underlying buffer space or how the
buffer is managed. `Encoder` or `Decoder` users are expected to use
sub-classes of `FrameWritePointer` to add the buffer space and
implement the frame buffer management scheme.

Two sub-classes `Hdlc::FrameBuffer` and `Hdlc::MultiFrameBuffer` are
also provided which respectively allow storing a single frame or
multiple frames (FIFO queue of frames) in a buffer of given size.

This commit also updates the `NcpUart` code to use the new buffer
model.

Finally, this commit adds an HDLC unit test `test_hdlc.cpp` which
covers the following:

- Verify behavior of `Hdlc::FrameBuffer` (single frame buffer),
- Verify behavior of `Hdlc::MultiFrameBuffer` (FIFO queue),
- Verify behavior of `Hdlc::Encoder` and `Hdlc::Decoder`,
- Test encoder/decoder with randomly generated frames (fuzz test).
2018-12-21 14:33:35 -08:00
Jiacheng Guo 71ef316bbd [mbedtls] build switch to disable mbedtls in makefile (#3389) 2018-12-21 09:32:57 -08:00
Jeff Bumgardner 782597fe1a [docs] Doxygen fix and efr32 README update (#3393) 2018-12-21 09:23:38 -08:00
Kamil Sroka 0724ce514d [nrf52840] fix build with ECDSA=1 (#3388) 2018-12-20 09:11:56 -08:00
Zhanglong Xia 19f2533aff [qos] handle NCP messages based on the priority of the message (#3318) 2018-12-19 13:55:26 -08:00
Zhanglong Xia 4ed2c8c222 [qos] forward messages based on the priority of the message (#3317) 2018-12-19 11:28:34 -08:00
Abtin Keshavarzian f4f92ab3a8 [ncp-base] remove unused method definitions from NcpBase class (#3386) 2018-12-18 15:27:45 -08:00
Rongli Sun a7f4283e5d [cc2538] add 1K stack space (#3385)
In the observed deepest CoAP process when handling JOIN_FIN, the large
local variables in the nested calls may take up to 2.5K, among with
the three local CoAP headers would add about extra 1K since #3210 which
increases CoAP header from 128 to 512.

This commit adjusts stack to be of 5K by increasing 1K to help commissioning
process goes correctly.
2018-12-18 09:29:39 -08:00
Rongli Sun 3e1b9aacb7 [coap] reduce stack occupation (#3385)
In #3210, CoAP header is increased from 128 to 512. Multiple
local CoAP header variables are declared in nested calls during
CoAP process, easily causing limited stack space overflow.

This commit tries to reuse existing local header variable to
reduce stack usage.
2018-12-18 09:29:39 -08:00
Jonathan Hui 2a75d30684 [docker] move dev environment setup to "Script to rule them all" (#3383) 2018-12-17 09:29:23 -08:00
Jonathan Hui 5b0ba23c10 [ecdsa] fix -Wimplicit-int-conversion warnings (#3382) 2018-12-17 09:28:43 -08:00
Abtin Keshavarzian 4e331fec9b [link-raw] update logs (#3373)
This commit changes the logs from `LinkRaw` class. With this change
the logs use debug log level and MAC log region. This change helps
reduce the spinel log traffic from RCP (NCP in radio-only mode).
2018-12-17 09:27:00 -08:00
Abtin Keshavarzian c482301ec7 [coap] remove Coap sub-classes (#3364)
This commit simplifies the COAP modules by renaming `CoapBase` to
`Coap` and removing the now unnecessary sub-classes `ApplicationCoap`
and `ApplicationCoapSecure`.
2018-12-14 12:20:59 -08:00
Abtin Keshavarzian 2610b9d5e0 [coap] update Coap/CoapSecure to use Context tracking Timer/Tasklet (#3364)
This commit simplifies `ResponseQueue`, `CoapBase`, `CoapSecure` to
use `TimerMilliContext` and `TaskeltContext`. This change removes
the need for sub-classes to provide the timer and tasklet callback
handlers.
2018-12-14 12:20:59 -08:00
Abtin Keshavarzian 8d4b424418 [tasklet] adding TaskletContext class (#3364)
This commit adds a new class `TaskletContext` which is a `Taskelt`
that also maintains a user context pointer.
2018-12-14 12:20:59 -08:00
Abtin Keshavarzian 1171a32a8c [timer] adding TimerMilliContext class (#3364)
This commit adds a new class `TimerMilliContext` which is a
millisecond timer that also maintains a user context pointer.
2018-12-14 12:20:59 -08:00
Abtin Keshavarzian 200b3dabcf [mle-router] stop mStateUpdateTimer on mode change (#3376)
This commit ensures to not re-start the `mStateUpdateTimer` from its
callback, when router role is disabled. This addresses the issue where
a mode change (disabling router role) could cause the timer to
continue to fire indefinitely, further causing device to attempt to
reattach from each timer callback.

Thanks to Conor O'Neill (@conormoneill) for discovering and debugging
this issue.
2018-12-14 11:21:55 -08:00
Zhanglong Xia 4279dbc14c [efr32] add support for RTT log (#3285) 2018-12-14 09:25:41 -08:00
Jonathan Hui ff0b30db55 [mle] limit number of child-router links a REED / FED maintains (#3358) 2018-12-13 10:44:30 -08:00
Jonathan Hui ce7b65e117 [tests] update 5.2.7 to not require Link Accept from DUT_ROUTER (#3358) 2018-12-13 10:44:30 -08:00
Abtin Keshavarzian 50fad599fa [link-raw] update to use Mac::Address to reverse extended address (#3377) 2018-12-13 09:04:12 -08:00
Abtin Keshavarzian cae23fd36c [src-match-controller] update to use Mac::Address (#3375)
This commit changes/simplifies the `SourceMatchController` class to
use the `Mac::Address` class API to reverse an extended address
when adding/clearing an address.
2018-12-13 09:03:17 -08:00
Abtin Keshavarzian 6d1c3b9e1d [mac] remove unused method definitions (#3374)
This class removes unused method definitions in `Mac` class. Note
that these methods are now provided and used in `SubMac`.
2018-12-13 09:02:29 -08:00
Yakun Xu cc10b31b9a [nrf52840] only enable ecdsa when OpenThread configures (#3370) 2018-12-13 09:01:52 -08:00
Abtin Keshavarzian cf841b1b71 [mesh-forwarder] fix double logging msg tx to non-sleepy child (#3368)
This commit moves the logging of a message transmission status and
updating of the counters in `MeshForwarder::HandleSentFrameToChild()`
inside an `if` block checking for the message to be indirect. This
change addresses an issue where message transmissions to a non-sleepy
child could be logged and counted twice from both `HandleSentFrame()`
and `HandleSentFrameToChild()`.
2018-12-13 09:00:37 -08:00
Yakun Xu de63012c9e [dhcp6-client] remove dhcp6 client api (#3287) 2018-12-12 09:58:15 -08:00
Łukasz Duda d369956d42 [ecdsa] do not free mpi context before initializing it (#3366) 2018-12-11 22:30:07 -08:00
Yakun Xu c281f284ff [cli] add an API to write string to UART (#3365) 2018-12-11 22:00:30 -08:00
Jonathan Hui edb7982f02 [bootstrap] add -y option to apt-get install (#3356) 2018-12-10 11:43:13 -08:00
Zhanglong Xia c3a0898e74 [mle] simplify the channel mask (#3349) 2018-12-10 11:42:53 -08:00
Abtin Keshavarzian f189cafcc7 [spinel] add capability definitions for FTD, MTD, RADIO configuration (#3357)
This commit adds new spinel capability definitions to specify the
FTD, MTD or RADIO build configurations. Depending on the OpenThread
build configurations the corresponding capability is included in
`SPINEL_PROP_CAPS` list.
2018-12-07 09:02:05 -08:00
Jonathan Hui c06179938c [examples] always build examples/platforms/utils (#3355) 2018-12-07 08:39:35 -08:00
Yakun Xu 04860bf422 [spi-hdlc-adapter] make pretty spi-hdlc-adapter (#3341) 2018-12-06 13:22:35 -08:00
Jonathan Hui 545ccd8dc8 [network-data] retrieve network data when restoring as leader (#3354)
The leader does not maintain network data in non-volatile memeory. As a
result, it is necessary for a recently-restored leader to obtain network
data from a neighboring device.
2018-12-06 08:49:17 -08:00
Łukasz Duda 6023df3a3f [network-data] synchronize 6LoWPAN Contexts after Leader is reset (#3353) 2018-12-06 08:48:15 -08:00
Yakun Xu 7b160157f8 [posix-app] eliminate unnecessary transactions with radio (#3350) 2018-12-05 17:52:26 -08:00
Yakun Xu dd4025ebb0 [android] build spi-hdlc-adapter in OpenThread (#3342) 2018-12-05 17:51:00 -08:00
Jonathan Hui 10897d3e97 [link] move otLinkSetShortAddress() decl to link_raw.h (#3348) 2018-12-05 05:49:13 -08:00
Yakun Xu 4c783e5584 [android] fix untracked pid in Android (#3343) 2018-12-04 14:38:55 -08:00
Jeff Bumgardner b61be18e37 [docs] added new Dockerfiles (#3347) 2018-12-04 13:19:38 -08:00
Jonathan Hui cc7cf137d6 [mbedtls] update to 2.14.0 (#3338) 2018-12-04 09:03:19 -08:00
Jonathan Hui a849306cf6 [mbedtls] update README (#3338) 2018-12-03 21:30:51 -08:00
Jonathan Hui f9b202998b [mbedtls] update mbedtls-config.h to fix build (#3338)
- Add stdio.h for snprintf.

- When `MBEDTLS_ECP_ALT` is defined, need to define mbedtls_ecp_restart_ctx
for build to succeed.
2018-12-03 21:30:36 -08:00
rongli 1253becb72 [meshcop] support operational dataset operations for MTD (#3339)
- This commit unties operational dataset operations from `OPENTHREAD_FTD` option.
- This commit also updates THCI for MTD certification
2018-12-03 21:28:09 -08:00
Hubert Miś 898ba45b0f [ip6] prefer ML-EID as realm-local scope source address (#3284) 2018-12-03 21:22:19 -08:00
Yakun Xu 22d6d1abf0 [android] correct version on android (#3340) 2018-12-03 09:24:22 -08:00
Matt Smith f58b8627b6 [logging] add initial log level config option (#3337)
Add OPENTHREAD_CONFIG_INTIIAL_LOG_LEVEL config setting to enable
starting OpenThread with a lower log level that the maximum compile-time
setting. Useful when OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL is
defined to 1.
2018-12-03 09:10:33 -08:00
Piotr Szkotak 6e25f6f15d [nrf52840] add support for the USB DFU software trigger (#3312) 2018-12-03 09:09:53 -08:00
Abtin Keshavarzian cc1c1a61ac [notifier] update changed flags logging to use multiple lines (#3336)
This commit changes `Notifier::LogChangedFlags()` to allow it to
use multiple lines when there are multiple flags.
2018-12-01 08:22:30 -08:00
Abtin Keshavarzian cd1e417750 [notifier] add strings for newly added OT_CHANGED flags in FlagToString (#3335) 2018-12-01 08:21:33 -08:00
Abtin Keshavarzian 5783c5c4b4 [toranj] adding test-028 for sequential router leader reset recovery (#3334) 2018-11-30 12:27:41 -08:00
Abtin Keshavarzian 305330114a [mle] clear router table before processing RouteTlv (#3334)
This commit removes the call to clear the `mRouterTable` from
`SetStateRouter()` and instead performs it before processing of a
received RouteTlv (before `ProcessRouteTlv()`). This ensures that
router table and router id allocation list are not deleted after a
router node reset recovery.

This change addresses a rare subtle issue where if a router node and a
leader node are reset sequentially within a short time interval, the
router node upon reset can delete the router id allocation list
(RouteTlv) which in turn causes the leader to ignore "MLE Link Accept"
message it receives from router (after leader resets and tries to
recover) and thus cause the leader to form a new partition. This can
potentially lead to a situation where the two nodes stay in two
partitions without merging.
2018-11-30 12:27:41 -08:00
Jonathan Hui 8ad315f725 [mle] print partition id as unsigned int (#3333)
Print partition id as unsigned int to be consistent with all other prints
of partition id.
2018-11-30 10:50:17 -08:00
Jing 6b01499e83 [thci] pass the channel mask as a comma separated channel string (#3321) 2018-11-29 08:53:19 -08:00
Piotr Szkotak a4670d6747 [nrf52840] update softdevice headers to version 6.1.1 (#3332) 2018-11-28 11:35:13 -08:00
Łukasz Duda 9e5df47e61 [nrf52840] make sure nrf_mbr.h is in include path (#3330) 2018-11-28 11:34:19 -08:00
Shu Chen e531b267b9 [android] fix a typo in Android.mk (#3329) 2018-11-28 10:11:52 -08:00
Yakun Xu fc95d5303a [meshcop] initialize commissioner ALOC (#3328) 2018-11-28 10:11:27 -08:00
hjian2017 88c8ed05eb [meshcop] simplify msg copy (#3327) 2018-11-28 10:10:51 -08:00
Abtin Keshavarzian 8d12513591 [mac] adding sub-MAC layer (#3262)
This commit introduces sub-MAC layer (class `Mac::SubMac`) in
OpenThread implementing a subset of IEEE802.15.4 MAC primitives which
are shared by both MAC layer (in FTD/MTD modes) and Raw Link (Radio
only mode).

The sub-MAC layer handles the following (if not provided by radio
platform):

  - Ack timeout for frame transmission,
  - CSMA backoff logic,
  - Frame re-transmissions,
  - Energy scan on a single channel and RSSI sampling.

It also act as the interface (to radio platform) for setting/getting
radio configurations such as short or extended addresses and PAN Id.

In addition, this commit contains following improvements in `Mac`:
- The implementation of `STAY_AWAKE_BETWEEN_FRAGMENTS` (delay sleep)
  feature is simplified by adding a new state variable tracking if
  sleep is being delayed and canceling sleep delay on start of any
  operation.
- Member variables in `Mac` class are re-ordered to avoid alignment
  gaps.
- `Mac` timers are combined into one which is used for Active Scan,
  Data Poll timeout, and delaying sleep.
2018-11-28 10:09:35 -08:00
Jonathan Hui 94dc2c0949 Merge commit '0b6efe3e561bd8654258f97321296be4c147cb22' into mbedtls 2018-11-27 16:04:59 -08:00
Jonathan Hui 0b6efe3e56 Squashed 'third_party/mbedtls/repo/' changes from 76dc065..f00d4be
556d7d9 Merge pull request #532 from sbutcher-arm/version-2.14.0
c1b9892 Update library version number to 2.14.0
b35e59d Refine the language in the ChangeLog
681edee Fix language and formatting in ChangeLog
06d80cf Fix merge of Changelog 128bit CTR_DRBG entry
de13963 Merge remote-tracking branch 'restricted/pr/520' into development-restricted-proposed
cdd1a6c Merge remote-tracking branch 'restricted/pr/510' into development-restricted-proposed
2ab14bb Clarified new platform errors in the ChangeLog
e51d4b3 Merge remote-tracking branch 'public/pr/2054' into development-proposed
6aa9fb4 Add ChangeLog entry
9924bdc Deprecate hardware acceleration errors
bcca58c Add common feature unavailable error
d83448b Merge remote-tracking branch 'public/pr/2052' into development-restricted-proposed
53b45ec Merge remote-tracking branch 'public/pr/2079' into development-restricted-proposed
bbc31b4 Merge remote-tracking branch 'public/pr/2085' into development-restricted-proposed
93a9b49 Merge remote-tracking branch 'public/pr/2077' into development-restricted-proposed
361ce6c Merge remote-tracking branch 'public/pr/2127' into development-restricted-proposed
c818131 Merge remote-tracking branch 'public/pr/2140' into development-restricted-proposed
241823a Merge remote-tracking branch 'public/pr/1641' into development-restricted-proposed
42ab4ae Merge remote-tracking branch 'public/pr/2167' into development-restricted-proposed
51b6abb Merge remote-tracking branch 'public/pr/2165' into development-proposed
f143a78 Adapt ChangeLog
7213744 Fix typo in comment
2981d8f Change to positive flow for all cases
93ace01 Revert positive flow check
b430d9f Change to positive checks
19779c4 Some style and documentation fixes
5ed8c1e Avoid using restartable and alternative ECP imp.
d3445da Adapt ChangeLog
b75ffb5 Don't perform binary comparison of CRL issuer and CA subject
1f8527f Move static x509_name_cmp() in library/x509_crt.c
a8b13d7 Add tests for relaxed CRL-CA name comparison
06f88e9 Merge remote-tracking branch 'public/pr/2007' into development-proposed
76646a4 Merge remote-tracking branch 'public/pr/1777' into development-proposed
2705bea Merge remote-tracking branch 'public/pr/2095' into development-proposed
710f203 Merge branch 'iotssl-1770' into development_thomas_dee
5517755 Improve wording and formatting of ASN.1 write module documentation
cec1c26 Break overly long line in library/x509_create.c
ee334a3 Remove Doxygen tags from documentation of private structure
beffcd8 Update hardcoded certificates in library/certs.c
6e1adee Regenerate test files
381c77c Change serial in test-ca.crt from 0 to 3 to circumvent ASN.1 bug
b12fd31 Adapt ChangeLog
cb93813 Don't perform binary comparison of CRL issuer and CA subject
0f6903d Move static x509_name_cmp() in library/x509_crt.c
52acdb5 Add tests for relaxed CRL-CA name comparison
b963081 Generate tests/data_files/test-ca_cat[12|21].crt from Makefile
386f99c Generate cli-rsa* CSRs and CRTs through Mbed TLS applications
0dd1139 Generate server5.req.ku.sha1 through Mbed TLS application
ebc1f40 Generate server2* CSRs and CRTs through Mbed TLS applications
b837775 Generate test-ca* CSRs and CRTs through Mbed TLS applications
50cb93a Generate server1* CRTs and CSRs through Mbed TLS applications
56e8463 Add 'password' cmd line parameter to cert_req example program
f745733 Add 'md' cmd line parameter to cert_req example program
2b161c3 Fix compilation issue
936d284 Minor fixes
8493f80 conditionaly compile ECDH and ECDSA alt functions
2b5be1e Fix ChangeLog entry for #2069
0bb204c Adapt ChangeLog
7904f94 Merge remote-tracking branch 'public/pr/1099' into development-proposed
4a865ef Add ChangeLog entry for PR #1618 - ARM DSP instruction support
d5bf428 Merge remote-tracking branch 'public/pr/1618' into development-proposed
5706452 Merge remote-tracking branch 'public/pr/2056' into development-proposed
b4e5451 Merge remote-tracking branch 'public/pr/2070' into development-proposed
17a0fab Merge remote-tracking branch 'public/pr/2111' into development-proposed
02ef525 Merge remote-tracking branch 'public/pr/2107' into development-proposed
a07d86e Merge remote-tracking branch 'public/pr/1902' into development
ef263eb Merge remote-tracking branch 'public/pr/1993' into development
3869384 Merge remote-tracking branch 'public/pr/2031' into development
da09561 Merge remote-tracking branch 'public/pr/2142' into development
ddc9e26 Merge remote-tracking branch 'public/pr/1627' into development
78dd2e5 Merge remote-tracking branch 'public/pr/1806' into development
1daecb4 Merge remote-tracking branch 'public/pr/1281' into development
e783f4a Merge remote-tracking branch 'public/pr/1609' into development
b10c660 Detect unsigned integer overflow in mbedtls_ecp_check_budget()
abdf67e Cast number of operations to `uint` in MBEDTLS_ECP_BUDGET
0eb8fb8 Correct typo in documentation of MBEDTLS_SSL_RENEGOTIATION
76cf60b Remove merge conflict marker in ssl-opt.sh
e4f965d Adapt ChangeLog
169712e Merge remote-tracking branch 'restricted/pr/390' into development
a74faba aes: xts: Correct NIST 80-38E to 800-38E
8381fcb aes: xts: Update inaccurate comments
cc40d86 Improve documentation of mbedtls_ssl_get_verify_result()
a966fde Fix some documentation typos and improve a comment
c774e32 Merge remote-tracking branch 'restricted/pr/517' into development
837f821 Merge remote-tracking branch 'public/pr/1990' into development
ca29fdf Fix some typos in documentation and comments
bcedb92 Merge branch 'development' into iotssl-1260-non-blocking-ecc-restricted
c028afb Merge pull request #2121 from dgreen-arm/mbedtls-jenkinsfile
b51e267 Add Jenkinsfile for PR job
f24c336 Adapt ChangeLog
dd3ab13 Fail when encountering invalid CBC padding in EtM records
198611d Add missing return value check in ECDSA test suite
96f3b4e Remove yotta support from check-files.py
b25cb60 Add a comment to clarify code flow
a5a3e40 Fix missing dereference.
7a28e99 Expand test to ensure no assumption on output
90f31b7 Improve readability by moving counter decrement
a58e011 Fix alignment in a macro definition
b843b15 Fix function name to fit conventions
c0edc96 Add comment on internal function API
d8b73f2 Remove unnecessary calls to init() from free()
c37423f Fix misleading sub-state name and comments
5267b62 Change error description
a27190b Rename platform error code and value
25781f9 Fix missing check in example client
ee68cff Fix or improve some comments (and whitespace)
32df911 Fix documentation of what functions restart when
7e1f3be Adapt ChangeLog
f0bbd7e Misc documentation fixes/improvements.
6346a75 Merge branch 'development' into iotssl-1260-non-blocking-ecc-restricted
0b44d5c Zeroize sensitive data in aescrypt2 and crypt_and_hash examples
805f2e1 Add missing zeroization of buffered handshake messages
9580528 ssl-opt.sh: fix typo in mtu settings
b459346 ssl-opt.sh: add a check for i686 targets
7782605 ssl-opt.sh: add comments regarding ciphersuite forcing
748face ssl_tls: fix maximum output length
7c6df83 ssl-opt.sh: revert unnecessary "autoreduction" checks
7311c78 ssl-opt.sh: force ciphersuites to reduce mtu size
780f0a4 Reinitialize PK ctx in mbedtls_pk_parse_key before reuse are free
cfa2e33 Omit runtime configuration of calloc/free if macro config enabled
e5fecec Add test for MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO to all.sh
8df1023 Add explicit unsigned-to-signed integer conversion
ac2ead0 Improve deterministic test for prime testing
e3f95ed Fix bias in random number generation in Miller-Rabin test
e0e7ddf Changelog: Add entry for prime validation fix
a0b67c2 Bignum: Deprecate mbedtls_mpi_is_prime()
da31fa1 Bignum: Fix prime validation vulnerability
64eca05 Bignum: Add tests for primality testing
b728c29 Bignum: Remove dead code
3332937 Changelog: Add entry for prime test improvement
b8fc1b0 RSA: Use MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR
a3cb7eb Bignum: Add test for improved prime generation
f301d23 Bignum: Improve primality test for FIPS primes
35f2f30 ssl-opt.sh: change expected pattern from 'resend' to 'autoreduction'
ef43ce6 Dtls: change the way unlimited mtu is set for client hello messages
abe6003 Adapt ChangeLog
095d9cf Fix ordering of free()ing of internal structures in ssl_server2
0fc9cf4 ssl-opt.sh: increase proxy mtu sizes to contain entire datagrams
1624e2e Avoid overly long lines X.509 DN attr array def in x509_create.c
35b6854 Replace reference to RFC 3280 by reference to newer RFC 5280
cfc47ba Correct some indentation and line lengths in x509_create.c
d355e69 Rename `tag` to `default_tag` in x509_attr_descriptor_t
d0e21fb Improve documentation of ASN.1 string-writing functions
d2c9009 Improve documentation of x509_attr_descriptor_t
dc71ef8 Adapt ChangeLog
0c161d1 Fix bounds check in ssl_parse_server_psk_hint()
948fe80 ssl-opt.sh: adjust test timeouts to fit slower targets
6290dae Disable dtls fragmentation for ClientHello messages
52f8491 ssl-opt.sh: adjust tests to fit slower targets
617a321 Adapt ChangeLog
30a9510 Fix memory leak and freeing without initialization in cert_write
16b1bd8 bn_mul.h: add ARM DSP optimized MULADDC code
d264258 Make inclusion of stdio.h conditional in x509_crt.c
95c5575 check-files: exclude .git and third-party files
404aa65 Add ChangeLog entry for Windows threading fix
6e3606e Fix run-test-suites.pl to screen for files
427df37 Don't try to disable ASLR
5c39d7a Remove redundant check in all.sh
bd90a8c In keep-going mode, don't hard-fail on some tests
a9daa5c Look for documentation only in specific directories
65593d2 rsa: pss: Add no possible salt size tests
80d99ea rsa: pss: Extend tests for variable salt length
3725bb2 rsa: pss: Enable use of big hashes with small keys
0592ea7 Merge remote-tracking branch 'public/pr/1140' into development
1afc767 Merge remote-tracking branch 'public/pr/1758' into development
c86993e Merge remote-tracking branch 'public/pr/1970' into development
c0514bf Added ChangeLog entry for yotta support removal
3ad2efd Remove Yotta support from the docs, tests and build scripts
487cdf5 In keep-going mode, don't hard-fail on some auxiliary script
2561a50 Fix "make WINDOWS_BUILD=1 clean" on non-Windows hosts
7c025a9 Generalize dh_flag in mbedtls_mpi_gen_prime
eba6c9b changes requested by @hanno-arm  - renamed `mbedtls_asn1_write_any_string` to `mbedtls_asn1_write_tagged_string`  - renamed `x509_at_oid_from_name` to `x509_attr_descr_from_name`
54a7c62 Minor style changes
5a481f1 Update error.h count for SSL
12e4a8b Improve documentation wording and formatting
1c1c20e Fix some whitespace issues
ff21572 rsa: pss: Use size_t when computing signatures
125af94 Merge branch 'development-restricted' into iotssl-1260-non-blocking-ecc-restricted
53546ea Update library version number to 2.13.1
5d40f67 Merge remote-tracking branch 'public/pr/1927' into development-restricted
d2ef254 Don't define _POSIX_C_SOURCE in header file
f5106d5 Don't declare and define gmtime()-mutex on Windows platforms
323d801 Correct preprocessor guards determining use of gmtime()
03b2bd4 Correct documentation of mbedtls_platform_gmtime_r()
a50fed9 Correct typo in documentation of mbedtls_platform_gmtime_r()
6f70581 Correct POSIX version check to determine presence of gmtime_r()
c52ef40 Improve documentation of mbedtls_platform_gmtime_r()
7dd82b4 platform_utils.{c/h} -> platform_util.{c/h}
5a7fe14 Don't include platform_time.h if !MBEDTLS_HAVE_TIME
9fbbf1c Improve wording of documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
c946888 Fix typo in documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
921b76d Replace 'thread safe' by 'thread-safe' in the documentation
9a51d01 Improve documentation of MBEDTLS_HAVE_TIME_DATE
acef292 ChangeLog: Add missing renamings gmtime -> gmtime_r
4e67cca Improve documentation of MBEDTLS_HAVE_TIME_DATE
48a816f Minor documentation improvements
651d586 Style: Add missing period in documentation in threading.h
6a73978 Rename mbedtls_platform_gmtime() to mbedtls_platform_gmtime_r()
be2e4bd Guard decl and use of gmtime mutex by HAVE_TIME_DATE and !GMTIME_ALT
5f95c79 Remove another mentioning of IAR from config.h
272675f Correct documentation of mbedtls_platform_gmtime()
cfeb70c gmtime: Remove special treatment for IAR
94b540a Avoid redefining _POSIX_C_SOURCE
45e3020 Document that IAR gmtime_s() is auto selected
433f911 Check for IAR in gmtime macros
e58088e Clarify docs for MBEDTLS_HAVE_TIME_DATE
c29c34c Improve wording of gmtime feature in ChangeLog
3c9733a Fix typo in comment for gmtime macro defines
193fe89 Add missing _POSIX_C_SOURCE define in threading.h
ca04a01 Document shorthand gmtime macros
8c9a620 Fix missing word in ChangeLog entry for gmtime()
2099606 Use gmtime_s() for IAR
e9b10b2 Define _POSIX_C_SOURCE in threading.c before POSIX detection
c2f948b Fix grammar in docs for MBEDTLS_HAVE_TIME_DATE
43e4ff0 Make definitions easier to understand
521e8a9 Fix to comment to correct module description
82986c1 Disable 3d test with no good openssl version
c1eda67 Disable fragmentation tests with openssl bugs
da642d9 Implicit _endthread call: comment changed
e1b82ad Added spaces after type casts
acedc91 Fix build issue on clang
e46c329 restore missing operation to CMakeLists.txt
85fcb58 Refactor test code for CTR DRBG to clarify test functions
b0ad581 Remove the invalid input for platform module
0ff4e0b Add platform error codes
6275be3 Re-factor test functions and add support for data_t parameters
b7ebbca compile time warning of 128bit ctr_drbg keys and standardized warnings
ce266e4 use single define for 128bit key for ctr_drbg and update test dependencies
6a4f224 ssl-opt.sh: change expected output for large srv packet test with SSLv3
a658d7d Fix style for mbedtls_platform_gmtime()
c99b12b Fix documentation for MBEDTLS_HAVE_DATE_TIME
5e863e0 Adapt ChangeLog
aa71500 Fix bug in SSL ticket implementation removing keys of age < 1s
1d73993 ssl-opt.sh: Add DTLS session resumption tests
aecf8c9 adding more ctr_drbg test vectors (CAVP 14.3)
e4b77b9 ctr_drbg: add a few test vectors from CAVP 14.3
cfc1de7 ctr_drbg: sample vectors from NIST
5ef5a9a ctr_drbg tests: unify validate functions
4c78665 ctr_drbg tests: new validation function that doesn't reseed
ef0624f ctr_drbg tests: make input sizes flexible
ed7da59 ctr_drbg: add comments relating the code with the NIST specification
954f987 change warning about 128bit keys to print
eb73f7a fix trailing white spaces
04354b0 add ChangeLog entry
c9547cc add NIST test vector for 128 bit keys (not passing yet).
604e60d add default value for CTR DRBG key size
a4588d4 enable the use of variable size keys in ctr_drbg (was hard-coded 256bit before)
248e27c Remove redundant statement from x509_get_current_time
a7b9f15 Add ChangeLog entry for configurable gmtime() in platform
1abb368 Make gmtime() configurable at compile-time
ffbdc61 Add test/zeroize.c
0b54419 More grammar alignment
d717743 Fix check-names.sh fail with USE_GMTIME macro
97f3ecb Document dependency on gmtime, gmtime_r & gmtime_s
824dfb3 Add ChangeLog entry for use of gmtime
ce6eebb Use gmtime when target is not windows or posix
aa22030 Further wording improvements
27a0460 Unify the grammar of descriptions
c2e5cdd Explain aescrypt2 better and warn that it doesn't do things properly
6b9cbb8 Copyediting
bb4bbbb Resolve PR review comments
6f90ed8 Fix CI failure
4e64e0b Fix after PR comments
7b01244 Add tests for mbedtls_cipher_crypt API
604ccc6 Add ChangeLog entry
636179a Fix typo
278af45 Fix hmac_drbg failure in benchmark, with threading
c8c12b6 Add NULL pointer check for consistency
78d7e8c Rename internal variable for consistency
4edb9cb Justify some max_ops settings in test_suite_pk
823c915 Fix mis-merged ChangeLog
597dbf8 Adds a filter to run-test-suites.pl to exclude data files
42c73a9 Merge remote-tracking branch 'origin/development' into development
755890f Remove trailing whitespace
e931d0e Replace Windows API threading with CRT functions
5c7e76e Remove trailing whitespace
da4029d ssl_server2: add buffer overhead for a termination character
95e2eca Fix IAR warning
c19fc55 Add missing large and small packet tests for ssl_server2
30e731d Added buffer_size and response_size options for ssl-server2. Added appropriate tests.
79d9b50 Merge branch 'development' into iotssl-1260-non-blocking-ecc-restricted
558da9c Make SSL error code more generic
b5d668a post-merge: adapt ssl-opt.sh to new error values
d0a66cc post-merge: fix ECDSA test vector testing
da19f4c Merge branch 'development' into iotssl-1260-non-blocking-ecc-restricted
020c823 fixed segmentation fault
c150f0d fixed missing initializer
c5c9aaf Merge branch 'development' of https://github.com/thomas-dee/mbedtls into development
23f954d Fix string downcast to `PrintableString` as issued in #1033
3efa888 Update ChangeLog with dtls sample IPv6 change
6fd96ad Change the default IP addresses for DTLS samples
ceb7b12 Readme with a short description of each sample program
a4dd783 Fix some typos in comments
bb216bd Fix MSVC 64-bit warnings
196d133 Fix uninitialised variable in some configs
46ba7f3 Avoid running useless code in tests
fd87e35 Improve comments on parity trick
95aedfe Remove redundant test on curve type
11556e2 Clarify initialization of T in mul_comb()
0b23f16 SSL: rework restart state handling
6348181 Explicit state assignments in ecdsa too
4ed1dab ECP: move state changes closer to operations
c9efa00 ECP: Use explicit state assignments
db4a8eb Use ECP_RS_ENTER/LEAVE() macros, as in ECDSA
b948f7d Don't bother to free NULL subcontexts
bfa1972 Remove redundant checks, save a few muls
28d1628 Avoid unnecessary xxx_copy() calls
5bd38b1 Replace memset() calls with xxx_init() calls
92cceb2 Make some names more consistent
ebac5d3 Fix some whitespace & style issues
eaf55be Misc documentation fixes/improvements
7037e22 Improve comments and doc for ECP
daf0491 Rework state saving for verify_chain()
a968843 Improve some comments in verify_chain()
3627a8b Clarify state handling in find_parent(_in)()
83e923b Better initialisation of ver_chain
8b7b96b Fix typo
d55f776 Skip context allocation if restart disabled
aaa9814 Uniformize ifdefs to ECDSA_C+ECP_RESTARTABLE
fe68770 Keep PK layer context in the PK layer
0bbc66c Dynamically allocate/free restart subcontext in PK
15d7df2 Introduce mbedtls_pk_restart_ctx and use it
98a6778 Better document some function arguments
b889d3e Clarify & uniformise test comments
5faafa7 Update X.509 test certs' Readme
c9e16a9 Disable restartable ECC by default
9897cc9 Update ChangeLog
3bf49c4 Enable restart for certificate verify
fed37ed Extract some code to separate function
39eda87 Make more auto variables const
6b7301c Change restart context type.
d27d1a5 Clean up existing SSL restartable ECC code
8b59049 Make verify() actually restartable
c11e4ba Rework type for verify chain
18547b5 Refactor find_parent() to merge two call sites
a4a5d1d Adapt function signatures to rs_ctx + ret
be4ff42 Call crt_check_signature from one place only
d19a41d Add tests for verify_restartable()
bc3f44a Introduce mbedtls_x509_crt_verify_restartable()
21b7719 Add ChangeLog entry for current progress
32033da Test some more handshake flows
23e4162 ECDH: not restartable unless explicitly enabled
1f1f2a1 Adapt ServerKeyEchange processing to restart
862cde5 Add restart support for ECDSA client auth
2350b4e Adapt ECDHE_ECDSA key exchange to restartable EC
b3c8307 Adapt ssl_client2 to restartable EC
171a481 Add a ChangeLog entry for changes so far
31f0ef7 Fix style issues introduced earlier
1f59606 Make PK EC sign/verify actually restartable
c4ee9ac Add tests for restartable PK sign/verify
82cb27b PK: declare restartable sign/verify functions
fd838da Comment cosmetics
66ba48a Make ECDH functions actually restartable
71b2c53 Add tests for restartable ECDH
c90d3b0 Update doc for restartable ECDH functions
af081f5 Make ECDSA sign actually restartable
50b63ba Use ecp_gen_privkey() in ECDSA sign
6754396 Improve sign/key_tries handling
b90883d Prepare infra for restartable sign
eb402f3 Add test for restartable signature
addb10e Create functions for restartable sign
5314f23 Make verify_restartable() actually restartable
a0c5bcc Add infrastructure for ecdsa_verify_restartable()
722e515 Add test for ecdsa_read_signature_restartable()
32aa437 Declare ecdsa_read_signature_restartable()
1ed2505 Add some negative testing for ecdsa_verify()
c751148 Make some macros/functions public
b5a50e7 Always declare restartable function variants
0ff17df Fix ECDSA test descriptions
4b9c51e Rename EARLY_RETURN -> RESTARTABLE
411079f Rm obsolete comment
a7937f9 Add public function generating private keys
1631d63 Make muladd_restartable() actually restartable
54dd652 Introduce muladd_restartable() and its sub-context
a08cd1a Avoid re-checking argument on restart
3a25612 Reset ops_done at the right time
53fbd63 Remove redundant check
884569c Avoid code duplication in ecp_mul()
646393b Move ops count to top-level context
8467e68 Stop checking for argument change
3cade22 Switch to restart context internally
8f28add Update documentation for new design/API
b739a71 Start moving to new design/API
45fd016 Rename multiplication-specific restart context
e58f65a Expand documentation with notes and warnings
e685449 Scale ops count for larger curves
d3a0ca8 Add tests about number of restarts
9c5c78f Fix indicative values of ops counts
1c678e0 Update doc about minimum max_ops value
213541a Make the first precomp loop restartable
ae55707 Turn double loop into single loop
e2d7cb3 Start splitting precompute_comb()
67c83fb Give a constant a name
fc3e0be Separate auxiliary array in precompute_comb()
07bf6f5 Tune T ownership code + comments
085b1df Allow T to be computed in multiple steps
c9c0aa6 Remember precomputed table
c5d844b Full restart support in ecp_mul_comb_core()
2fad7ae Start actually splitting computation
8962ddb Don't write to destination until we're done
78d564a Add check for changing arguments
77af79a Add proper allocation of restart context
62738e9 Further restrict variable scope by moving code
391f441 Move more code to separate function
24be795 Group related code together
4b2336d Move some more code to new function
22be635 Re-order some more code
ec5606a Extract code to separate function
7306dff Group related code together
510d5ca Add early return test + fake implementation
054433c Add mbedtls_ecp_set_max_ops()
5e3c62f Add MBEDTLS_ERR_ECP_IN_PROGRESS
c3a3bc7 Add config flag MBEDTLS_ECP_EARLY_RETURN
225b37a Fix typos in comment

git-subtree-dir: third_party/mbedtls/repo
git-subtree-split: f00d4bea1709e24c6f407b6aa296e8d283bca684
2018-11-27 16:04:59 -08:00
Abtin Keshavarzian 5d6dccf35c [radio-spinel] determine presence of Ack from spinel TxDone frame (#3313)
This commit changes `RadioSpinel` to determine if Ack is present
directly from the received spinel TxDone frame (i.e. check the
remaining unparsed length of spinel frame to determine if ack frame is
included by Radio Co-Processor (RCP)). This change helps simplify the
code by removing the requirement for `RadioSpinel` as the layer
between OpenThread core and RCP to parse the 15.4 frame.
2018-11-27 10:05:18 -08:00
Shu Chen 2a3384c650 [android] include user defined configuration in Android.mk (#3320)
It introduces a way that user can define product specific configuration
for OpenThread build in Android Environment.

Also ensure that ot-cli and ot-ncp use the same mbedtls config with
ot-core.
2018-11-27 09:10:35 -08:00
Abtin Keshavarzian 0190f9bd9c [radio-spinel] always be ready to ready from socket (#3319)
This commit changes the logic in `RadioSpinel` such that the HDLC
socket is always added to read fd set in `UpdateFdSet()` replacing
the existing code where read was not allowed during an ongoing 15.4
frame transmission. Note that during a frame transmission, radio can
potentially receive a frame (e.g. during CSMA backoffs). Also other
spinel frames such as logs can be received during tx.
2018-11-26 12:44:50 -08:00
Stuart Longland fac323d548 [coap] update the Content-Format enumeration (#3316)
Since RFC-7252 a number of additions have been made to the CoAP
Content-Format registry which is maintained by the IANA.  This patch
updates the list in OpenThread.  Notably:

- Standards references are made for each entry
- Some invalid assignments have been removed (notably PKCS10, PKCS7 and
  JWS)
- New entries have been added for COSE, JSON patches, merge patches,
  CBOR, CWT, CoAP groups, SENML and SENSML.
2018-11-26 10:55:54 -08:00
Abtin Keshavarzian 122b8bbfe2 [radio-spinel] simplify state definitions in RadioSpinel. (#3314)
This commit defines as new set of `State` enumerations which
combines the two state variables `otRadioState` and `TxState`
into a single `mState` variable.
2018-11-26 10:30:40 -08:00
Zhanglong Xia 71753b3cb6 [cli] add channel monitor and channel manager commands (#3286) 2018-11-26 10:28:59 -08:00
Jeff Bumgardner cfc4882c3d [docs] tag APIs that are reserved for testing/demo purposes (#3308) 2018-11-19 10:23:40 -08:00
Abtin Keshavarzian 3b158a61e9 [hdlc-interface] ignore errno EINTR in socket read (#3310)
This commit changes `HdlcInterface::Read()` method to ignore `errno`
`EINTR` (interrupt by a signal) during socket `read()`. It also
uses `exit()` on error.
2018-11-19 09:47:08 -08:00
Abtin Keshavarzian 3f3970ccaa [hdlc-interface] wait for socket to be writable when sending a frame (#3309)
This commit changes `HdlcInterface` method `SendFrame()` to handle
the case where the socket associated with the HDLC interface is
not immediately ready to accept the frame. With the change in this
commit `SendFrame()` will block and wait for socket to become
writable within a timeout interval.
2018-11-19 09:46:06 -08:00
Yakun Xu 1801b0713f [ip6] use 64 as aloc prefix length (#3307) 2018-11-17 12:05:40 -08:00
Jonathan Hui cd2521f53a [style] add use of OT_UNUSED_VARIABLE (#3299) 2018-11-17 12:04:41 -08:00
Jonathan Hui e14d763e2e [style] relocate OT_UNUSED_VARIABLE (#3299) 2018-11-17 12:04:41 -08:00
Jonathan Hui f6afc5599a [style] apply OT_UNUSED_VARIABLE (#3299) 2018-11-17 12:04:41 -08:00
Jonathan Hui 2de3258cbd [mle] do not respond to MLE Parent Requests in detached state (#3295) 2018-11-17 12:04:02 -08:00
Abtin Keshavarzian 1fece5f546 [toranj] update test-603 to use verify_within() (#3306) 2018-11-15 15:57:23 -08:00
Abtin Keshavarzian 5baba6fea8 [ncp] add new spinel capability SPINEL_CAP_THREAD_BORDER_ROUTER (#3305)
This capability mirrors `OPENTHREAD_ENABLE_BORDER_ROUTER` feature
informing host that on-mesh prefix or off-mesh routes can be added
on NCP.
2018-11-15 15:53:18 -08:00
Abtin Keshavarzian bfc7985157 [radio-spinel] use a dedicated mAckRadioFrame for acks (#3304)
This commit uses a separate frame buffer (`mAckRadioFrame`) for saving
acks instead of using `mRxRadioFrame` (which is used for received
frames).

This ensures that the ack frame won't be overwritten by a subsequently
received frame.

- Ack frame is read and saved in `HandleTransmitDone()` (which we get
  to from `HandleSpinelFrame() -> HandleResponse() ->
  HandleTransmitDone()`).

- But note that the saved ack frame is not immediately used, it is
  passed from `RadioSpinel::Process()` to next layer using
  `otPlatRadioTxDone()` callback.

- We can technically read and decode multiple spinel frames from a
  single call to `mHdlcInterface.Read()`:

  - So we can possibly get a TxDone spinel frame response where we
    read and save the ack frame;

  - And before getting the chance to get to `Process()`, from the same
    `mHdlcInterface.Read()` we can get a `VALUE_IS(STREAM_RAW)` spinel
    frame (i.e., receive a frame) which would then overwrite the ack
    frame (assuming we use `mRxRadioFrame` to save the ack)

- Using a separate ack frame (`mAckRadioFrame`) addresses this issue.
2018-11-14 18:38:37 -08:00
Abtin Keshavarzian 6e3b9c9758 [radio-spinel] remove dst address check logic in received frame (#3303)
This commit removes the destination address and PAN Id checks in
`RadioSpinel::RadioReceive()` method. Radio Co-Processor (RCP)
typically provides such filtering. If not, the same checks are
performed by OpenThread core in `Mac:: HandleReceivedFrame()`.
2018-11-14 17:33:08 -08:00
Abtin Keshavarzian c7d8ae3693 [mac] log some of the less useful RX errors at debug log level (#3302) 2018-11-14 17:32:26 -08:00
Abtin Keshavarzian 49523f72e6 [radio-spinel] remove unused method HandleHdlcError (#3301) 2018-11-14 17:32:02 -08:00
Jonathan Hui bf72fd8f8d [qos] check frame length when reading UDP header (#3298)
Credit to OSS-Fuzz.
2018-11-14 17:31:29 -08:00
Yakun Xu 33b0ee9330 [netif] add address callback (#3249) 2018-11-13 19:29:52 -08:00
Abtin Keshavarzian 08747cf7a7 [toranj] update test-010 to use verify_within (#3297)
This commit changes `test-010-on-mesh-prefix-config-gateway` to use
`wpan.verify_within` instead of using fixed delays.
2018-11-13 15:49:11 -08:00
Jonathan Hui 1b1a1e7bc6 [mle] avoid shadow declaration with kVersion (#3294)
Credit to OSS-Fuzz.
2018-11-13 15:17:03 -08:00
Abtin Keshavarzian 0863b652b2 [posix-app] add HdlcInterface class (#3293)
This commit adds a new class `HdlcInterface` under POSIX App which
performs HDLC encoding/decoding and read/write operations on the
interface to Radio Co-Processor (RCP). `RadioSpinel` is updated to
use the new class.
2018-11-13 15:16:48 -08:00
Łukasz Duda 5da7469269 [nrf52840] update README.md (#3290) 2018-11-13 15:16:08 -08:00
Joseph Newman bf6e854a85 [efr32] add missing volatile qualifiers (#3292) 2018-11-12 18:23:19 -08:00
Joseph Newman 7d36e8d913 [time-sync] fix incorrect status after boot (#3291) 2018-11-12 18:22:51 -08:00
Łukasz Duda 9f7bc3a6ec [posix] enable sntp client by default (#3289) 2018-11-12 15:55:16 -08:00
Łukasz Duda 6a0f35c63c [coap] remove functional code from assert (#3288) 2018-11-12 15:54:40 -08:00
Łukasz Duda 90dd7a42d0 [nrf52840] fix uart configuration of HWFC (#3277) 2018-11-12 15:52:20 -08:00
Łukasz Duda 90593db103 [nrf52840] suppress warning in mbedtls in Keil and IAR compiler (#3283) 2018-11-09 09:03:23 -08:00
Abtin Keshavarzian 765c45c2ed [ncp] allow pcap without link-raw (#3274)
This commit adds a new spinel property `SPINEL_PROP_PHY_PCAP_ENABLED`
to allow packet capture (pcap) to be enabled independently of
link-raw mode. This allows pcap to be used on NCPs while running full
Thread protocol.
2018-11-09 08:59:20 -08:00
Zhanglong Xia 8440656f88 [cc1352] fix clearing source match entry issue (#3279)
Fixes the same issue on platform cc2650 and cc2652
2018-11-09 06:38:27 -08:00
Jeff Bumgardner fa8dcf7ef4 [docs] update Doxygen TOC (#3282) 2018-11-08 20:38:09 -08:00
Yakun Xu 5d4d74b1b5 [style] use debug.hpp instead of assert.h in core (#3276) 2018-11-08 09:00:49 -08:00
Yakun Xu d22a75be8d [coaps] defer sending coaps message (#3258) 2018-11-08 08:59:36 -08:00
Zhanglong Xia 4693638f77 [qos] process IPv6 packet priority (#3201) 2018-11-07 23:16:34 -08:00
Yakun Xu cf5352fb43 [api] add API to find source address (#3273) 2018-11-07 22:35:39 -08:00
Joseph Newman 4f99bcfaf3 [ncp] notify host asynchronously upon a significant thread network time change (#3238) 2018-11-07 22:32:31 -08:00
Joseph Newman a5f1ed263d [cli] fix network time format specifier (#3278) 2018-11-07 11:35:18 -08:00
Abtin Keshavarzian 720500be71 [ncp] fix constructor initializer list format (#3275) 2018-11-06 15:11:35 -08:00
Yakun Xu 38bd256997 [posix-app] update README.md for USB=0 (#3272) 2018-11-06 10:31:14 -08:00
Jing 6f578589ff [harness-automation] add new test cases according to testplan changes (#3270) 2018-11-05 20:48:48 -08:00
Yakun Xu b9b57cc9e2 [core] rename UDP proxy to UDP forward (#3266)
Thread defines UDP proxy as a feature to allow secure, two-way
communication of Thread Management Commands between the Commissioner
and any Thread Device in the Thread Network via the Border Agent.

This commit renames the existing UDP proxy feature which forwards UDP
packets back and forth between Host and NCP to UDP forward.
2018-11-05 20:48:08 -08:00
Yakun Xu 8533ee3936 [mle] add address outside of constructor (#3251)
This commit adds link local address when MLE is enabled. Adding address in
constructor gives no chance to notify address change with address
callback.
2018-11-05 20:46:08 -08:00
Zhanglong Xia f8909593a9 [api] update message API to create message with priority (#3199) 2018-11-05 12:48:39 -08:00
Zhanglong Xia f5fdf506ad [mac] remove dead code (#3254) 2018-11-05 08:32:37 -08:00
Jonathan Hui 9a1dc1eeae [style] fix code style (#3267) 2018-11-03 18:33:45 -07:00
Abtin Keshavarzian b48498c15a [spinel] add documentation on used commands in "spinel.h" (#3265) 2018-11-03 14:51:05 -07:00
Yakun Xu 85c21ae1df [posix-app] move die functions to misc.c (#3264) 2018-11-03 14:48:13 -07:00
Yakun Xu 9ba3fc1d9b [netif] add notification for up or down (#3248) 2018-11-03 14:44:18 -07:00
Abtin Keshavarzian b6cdb09f38 [mac] move "FillMacCountersTlv()" to NetworkDiagnostic class (#3263) 2018-11-03 08:13:45 -07:00
Łukasz Duda 4a89cc63b6 [sntp] initial implementation of sntp client (#3237) 2018-11-03 08:11:05 -07:00
Jonathan Hui 8f25db11cc [coap] fix header length calculation overflow error (#3260)
Credit to OSS-Fuzz.
2018-11-03 08:09:14 -07:00
Jonathan Hui 7518eb1fb8 [dtls] map OT errors from send callback to MBEDTLS_ERR_NET_SEND_FAILED (#3259)
Credit to OSS-Fuzz.
2018-11-03 08:08:58 -07:00
Jonathan Hui cb1b4c72a8 Merge pull request #3245 from jwhui/mbedtls
[mbedtls] update to 2.13.0
2018-11-03 08:08:22 -07:00
Jonathan Hui e7b7f3f060 [mbedtls] update README 2018-11-02 21:41:34 -07:00
Jonathan Hui 8d02956c36 [mbedtls] fix build 2018-11-02 15:37:01 -07:00
Jonathan Hui c56e5ea0c4 Merge commit 'e2accb88650112777d9e5b8e0a5bb8576d6eab2a' into mbedtls 2018-11-02 15:36:41 -07:00
Jonathan Hui e2accb8865 Squashed 'third_party/mbedtls/repo/' changes from 38b64b0..76dc065
c0a63bd Remove duplication of some entries in the ChangeLog
b70158b Merge pull request #505 from sbutcher-arm/mbedtls-version-2.13.0
4d075cd Update library version number to 2.13.0
b5afb97 Revised and clarified ChangeLog
0bbb4fc Merge branch 'development' into development
552754a Merge remote-tracking branch 'public/pr/1988' into development
68dbc94 Merge remote-tracking branch 'public/pr/1951' into development
e50128a Merge remote-tracking branch 'public/pr/1994' into development
07de4c0 Merge remote-tracking branch 'public/pr/1920' into development
822a9cc Merge remote-tracking branch 'public/pr/1994' into development-restricted
108992e Add MTU auto-reduction test with valgrind
37029eb Skip MTU auto-reduction test when running valgrind
f34a4c1 UDP proxy: Correct debug output for delay_srv option
a591c48 Correct typo in debug message
83ab41c Correct typo in comment
cd9dcda Add const qualifier to handshake header reading functions
39b8bc9 Change wording of debug message
ef7afdf  Rename another_record_in_datagram to next_record_is_in_datagram
c573ac3 Fix typos in debug message and comment in ssl-tls.c
7c48dd1 ssl-opt.sh: Add function extracting val or default val from config.h
dc1e950 DTLS reordering: Add test for buffering a proper fragment
8a552cf Merge remote-tracking branch 'public/pr/1920' into development-restricted
3af567d Merge remote-tracking branch 'restricted/pr/437' into development-restricted
129fa82 Merge remote-tracking branch 'restricted/pr/470' into development-restricted
7f85563 Merge remote-tracking branch 'restricted/pr/491' into development-restricted
97a1c13 Correct typo in documentation of MBEDTLS_SSL_DTLS_MAX_BUFFERING
02f6f5a Adapt ChangeLog
9ce5160 Merge remote-tracking branch 'public/pr/1965' into development
676d3fd Merge remote-tracking branch 'public/pr/1129' into development
9d5a9e1 Merge remote-tracking branch 'public/pr/1625' into development
14dac09 Merge remote-tracking branch 'public/pr/1918' into development
1846e40 Merge remote-tracking branch 'public/pr/1939' into development
9598845 Merge remote-tracking branch 'public/pr/1955' into development
4613772 Merge remote-tracking branch 'public/pr/1915' into development
e604556 ssl-opt.sh: Don't hardcode varname in requires_config_value_xxx()
4103810 Style: Correct indentation in UDP proxy code
eefe084 Style: Spell out PMTU in ssl.h
0207e53 Style: Correct typo in ssl-tls.c
b841b4f ssl-opt.sh: Remove reference to Github issue
3b8b40c ssl-opt.sh: Add function to skip next test
6f032a6 Merge remote-tracking branch 'public/pr/1963' into development
badeb07 Merge remote-tracking branch 'public/pr/1967' into development
b9a0086 ssl-opt.sh: Explain use of --insecure in GnuTLS client tests
ea85848 Merge remote-tracking branch 'public/pr/1979' into development
bc2498a Style: Add numerous comments indicating condition guarded by #endif
cf46945 Style: Add empty line before comment in UDP proxy code
d584777 Style: Group buffering-related forward declarations in ssl_tls.c
360bef3 Reordering: Document that only HS and CCS msgs are buffered
4f432ad Style: Don't use abbreviations in comments
b8f5014 Add explicit MBEDTLS_DEBUG_C-guard around debugging code
f0da667 Style: Add braces around if-branch where else-branch has them
ecbdf1c Style: Correct indentation of debug msgs in mbedtls_ssl_write_record
3f7b973 Correct typo in mbedtls_ssl_flight_transmit()
2800751 DTLS Reordering: Improve doc of MBEDTLS_SSL_DTLS_MAX_BUFFERING
159a37f config.h: Don't use arithmetical exp for SSL_DTLS_MAX_BUFFERING
2f5aa4c all.sh: Add builds allowing to test dropping buffered messages
a1adcca ssl-opt.sh: Add tests exercising freeing of buffered messages
5cd017f ssl-opt.sh: Allow numerical constraints for tests
6e12c1e Enhance debugging output
0e96585 Merge branch 'datagram_packing' into message_reordering
69ca0ad ssl-opt.sh: Remove wrong test exercising MTU implications of MFL
6b6f602 Merge branch 'iotssl-165-dtls-hs-fragmentation-new' into datagram_packing
c92b5c8 ssl-opt.sh: Add tests checking that MFL implies bounds on MTU
eb57008 Fix typo in documentation of mbedtls_ssl_set_datagram_packing()
1841b0a Rename ssl_conf_datagram_packing() to ssl_set_datagram_packing()
f4b010e Limit MTU by maximum fragment length setting
283f5ef Buffering: Free future record epoch after each flight
081bd81 ssl_write_handshake_msg(): Always append CCS messages to flights
c83d2b3 ssl_write_handshake_msg(): Allow alert on client-side SSLv3
34aa187 Force IPv4 for gnutls-cli DTLS tests
a63c1c3 pk_encrypt: Uniformize debugging output
25d882b Fix typos in programs/x509/cert_write.c
ae513a5 Minor formatting improvements in pk_encrypt and pk_decrypt examples
a70fb95 Adapt ChangeLog
bd336c1 Correct memory leak in pk_decrypt example program
55c11ba Correct memory-leak in pk_encrypt example program
b309b92 ssl_buffering_free_slot(): Double-check validity of slot index
12b72c1 UDP proxy: Fix bug in freeing delayed messages
65dc885 Use size_t for msg_len argument in ssl_get_reassembly_buffer_size()
1b20e8e Merge branch 'datagram_packing' into message_reordering
554b0af Fix assertion in mbedtls_ssl_write_record()
7428d4f Merge branch 'datagram_packing' into message_reordering
551835d ssl_write_handshake_msg(): Always append CCS messages to flights
2c98db2 ssl_write_handshake_msg(): Allow alert on client-side SSLv3
6353134 Merge branch 'datagram_packing' into message_reordering
11682cc Uniformly treat MTU as size_t
98081a0 Don't use uint8_t for bitfields
aa24937 Adapt ChangeLog
3546201 Merge branch 'datagram_packing' into message_reordering
a67dee2 Merge branch 'iotssl-2402-basic-pmtu-adaptation' into datagram_packing
f47a4af Fix a typo in comments
b8eec19 Implement PMTU auto-reduction in handshake
170e2d8 Merge branch 'iotssl-165-dtls-hs-fragmentation-new' into datagram_packing
68ae351 Fix some whitespace in documentation
c1d54b7 Add tests with non-blocking I/O
3d183ce Allow client-side resend in proxy MTU tests
903ee3d Merge branch 'datagram_packing' into message_reordering
01315ea Account for future epoch records in the total buffering size
a02b0b4 Add function making space for current message reassembly
175cb8f ssl-opt.sh: Allow resend in DTLS session resumption tests, cont'd
e180139 Add another debug message to ssl_buffer_message()
e356705 ssl-opt.sh: Add test for reassembly after reordering
101bcba UDP proxy: Allow more than one message to be delayed
55e9e2a Free future buffers if next handshake messages can't be reassembled
e605b19 Add function to free a particular buffering slot
96a6c69 Correct bounds check in ssl_buffer_message()
e0b150f Allow limiting the total amount of heap allocations for buffering
2a97b0e Introduce function to return size of buffer needed for reassembly
5bcf2b0 ssl-opt.sh: Allow spurious resend in DTLS session resumption test
e678eaa Reject invalid CCS records early
6b13afe Fix indentation
47db877 ssl_write_record: Consider setting flush variable only if unset
1f5a15d Check retval of remaining_payload_in_datagram in ssl_write_record()
ecff205 Remove stray bracket if MBEDTLS_ZLIB_SUPPORT is defined
f61ff4e ssl_server2: Remove redundant new line
d22c1b2 Merge remote-tracking branch 'upstream-public/pr/1932' into development
2f2d902 Add delay in test to avoid race condition
6611035 Try to further clarify documentation
000281e Fix "unused parameter" warning in small configs
f2f1d40 Improve wording in ChangeLog and documentation
6151298 Add missing requires_gnutls guards
9434713 Move the assertion
6aeaa05 Merge branch 'iotssl-165-dtls-hs-fragmentation-new' into datagram_packing
f362c29 ssl-opt.sh Add dependency on gnutls in two fragmentation tests
7be2e5b ssl-opt.sh: Preserve proxy log, too, if --preserve-logs is specified
4e1a9c1 ssl-opt.sh: Preserve proxy log, too, if --preserve-logs is specified
513815a Fix typo in debugging output
4cb782d Return from ssl_load_buffered_record early if no record is buffered
a1071a5 Compute record expansion at the right time
4532329 Add proxy-enforcement to a MTU test
9829315 Add missing dependency in ssl-opt.sh
58e9dc3 Allow GNUTLS_NEXT_CLI / GNUTLS_NEXT_SERV to be unset in ssl-opt.sh
050dd6a Improve documentation of ssl_set_mtu().
065a2a3 Fix some typos and links in comments and doc
02f3a8a Adjust timeout values for 3d test
caf8741 Fix typo in documentation of UDP proxy argument 'delay_cli'
3a0aad1 Rename `update_digest` to `update_hs_digest`
4422bbb Whitespace fixes
e00ae37 Omit debug output in ssl_load_buffered_message outside a handshake
6e7aaca Move MTU setting to SSL context, not config
0d4b376 Return through cleanup section in ssl_load_buffered_message()
34b03ef Remove redundant `else` statement
56cdfd1 Refine reordering tests
01ea778 UDP proxy: Add option to delay specific handshake messages
56d5eaa Mark SSL ctx unused in ssl_prepare_reassembly_buffer() if !DEBUG
8727304 Disable datagram packing in reordering tests
d488b9e Increase maximum number of buffered handshake messages
f103542 Adapt ChangeLog
b063a5f Update error codes
b34149c Add test for buffering of record from next epoch
5f066e7 Implement future record buffering
e384221 Add test for reordering of handshake messages
37f9532 Implement future message buffering and loading
6d97ef5 Use uniform treatment for future messages and proper HS fragments
44650b7 Introduce function checking sanity of the DTLS HS header
12555c6 Introduce function to parse total handshake length
0271f96 Introduce buffering structure for handshake messages
d7f8ae2 Introduce sub-structure of ssl_handshake_params for buffering
e25e3b7 Add function to check is HS msg is a proper fragment
d07df86 Make allocation of reassembly bitmap optional
56e205e Prepare handshake reassembly in separate function
9e1ec22 Return MBEDTLS_ERR_SSL_EARLY_MESSAGE for future HS messages
aa5d0c4 Add test for buffering out-of-order CCS
2ed6bcc Implement support for remembering CCS messages
40f5084 Add frame for loading and storing buffered messages
e74d556 Introduce function to indicate if record is fully processed
2699459 Move call to ssl_consume_current_message()
1097b34 Extract message-consuming code-path to separate function
4162b11 Make mbedtls_ssl_read_record_layer() static
a4b143a Remove nested loop in mbedtls_ssl_read_record()
02f5907 Correct misleading debugging output
327c93b Add parameter to ssl_read_record() controlling checksum update
e1dcb03 Don't send empty fragments of nonempty handshake messages
4a9d006 Add missing dependency in ssl-opt.sh
bc73e4a Allow GNUTLS_NEXT_CLI / GNUTLS_NEXT_SERV to be unset in ssl-opt.sh
d87a59c Adapt ChangeLog
7ae8a76 Add tests for datagram packing option to ssl-opt.sh
1c9a24c Disable datagram packing for various UDP proxy tests
c430523 Re-enable delayed CCS test
4d61591 Add cmd line option to ssl_client2 for datagram packing
e7675d0 Add cmd line option to ssl_server2 for datagram packing
04da189 Make datagram packing dynamically configurable
12405e7 Increase max_frag_len / MTU in fragmentation ref tests
7e77213 Fix unused variable warning in ssl_session_reset_int()
0defedb Fix unused variable warning in mbedtls_ssl_get_max_record_payload
f29d470 Reset in/out pointers on SSL session reset
4ccbf06 Minor improvements in ssl_session_reset_int()
2a43f6f Introduce function to reset in/out pointers
111fa49 TEST-ONLY: Remove delayed CCS test
b50a253 Move size check for records
67bc7c3 Don't immediately flush datagram after preparing a record
2b1e354 Increase record buffer pointer after preparing a record
3b23590 Log calls to ssl_flight_append() in debugging output
0448462 Increment record sequence number in ssl_write_record()
1985947 Store outgoing record sequence number outside record buffer
5aa4e2c Move deduction of internal record buffer pointers to function
3136ede Compute record expansion in steps to ease readability
141e767 Merge remote-tracking branch 'upstream-public/pr/1942' into development
6fba810 Merge remote-tracking branch 'upstream-public/pr/1938' into development
38110df Add interop test with unreliable connection
d26bb20 Add tests for empty CA list in CertificateRequest, TLS 1.0 & 1.1
0794d49 Skip some tests with valgrind (spurious resend)
1218bc0 Add simple interop tests (reliable connection)
3879fdf Merge remote-tracking branch 'public/pr/1955' into iotssl-165-dtls-hs-fragmentation-new
eb2b15a Improve ChangeLog wording for the commmit that Fixes #1954.
ad0fe92 Adapt ChangeLog
ad17fe9 Fix overly strict bounds check in ssl_parse_certificate_request()
aa9f3fd Merge remote-tracking branch 'upstream-public/pr/930' into development
2d56f0d Add test with unreliable connection
19c62f9 Add test for session resumption
7e89c17 Fix two typos in comments
72c2707 Add tests for MTU with renegotiation
b747c6c Add basic first tests for MTU setting
637e234 Merge remote-tracking branch 'public/pr/1915' into iotssl-165-dtls-hs-fragmentation-new
9468ff1 Implement support for MTU setting
0b1d9b2 Declare ssl_conf_mtu()
01ec4af Add ChangeLog entry
2cb17e2 Make handshake fragmentation follow max_frag_len
28f4bea Start implementing fragmentation
87a346f Always save flight first, (re)send later
9c3a8ca Clarify code a bit in write_handshake_msg()
31c1586 Start separating handshake from record writing
2c069df Fix typo in test_suite_entropy.function
08a4aeb HKDF: Add warning to partial functions
d0a78e9 HKDF: Fix style issue
9dc3be7 Improve wording in ChangeLog
9ebdcff Fix Wformat-overflow warning in ssl_mail_client.c
361f254 Adapt ChangeLog
7864090 Reset session_in/out pointers in ssl_session_reset_int()
446227a Enhance nist_kw with some NULL buffers tests
d1a4762 Use mbedtls_printf instead of printf
d8f4169 Merge remote-tracking branch 'upstream-public/pr/1598' into development
03bd484 Merge remote-tracking branch 'upstream-public/pr/1861' into development
cac0c1a Merge remote-tracking branch 'upstream-public/pr/1378' into development
603aee0 Merge remote-tracking branch 'upstream-public/pr/1816' into development
372b50b Add a ChangeLog entry for #1816
f48163a Merge remote-tracking branch 'upstream-public/pr/1834' into development
58e9c18 Fix Wformat-overflow warning in ssl_mail_client.c
5cb7017 Less obscure test suites template
d2d0112 Style fixes
440d873 Fix macro validation regex
ee6529e Add generate_test_code.py unit tests in all.sh
2179810 Pylint tests in all.sh
539aa06 Fix Python 2 & 3 compatibility in test_generate_test_code.py
32cbcda Fix Pylint errors in Python scripts
6302813 Replaced escaped_split() logic with regex
fcdf685 Make test function parsing robust
4084ec7 Fixed unit tests in test_generate_test_code.py
8d686bf Incorporated code revoew comments.
b31aa44 Fix style errors reported by pylint
aee05bb Add test suite framework summary
63ab501 Fix generate_test_code.py argument --helpers-file in CMakeLists.txt
27a35e7 Wildcard possible targets and document
5fcca46 Rename HexParam_t -> data_t for consistent coding style
62a5d7d Document status/error codes in helper.function
951a2c8 Improve documentation in mbedtls_test.py
e3b26af Improve documentation in generate_test_code.py
b98e6ee Replace asserts with exceptions in mbedtls_test.py
040b6a2 Wrap code to 79 character limit
936ea93 Strip whitespaces added by decode() function
00c4b09 Change intermediate data file extension to .datax
ff560f2 Rename makefile target gen-embedded-test - generate-target-tests
cfd8342 Use integer instead of string as test result
53faf5c Widen the test app columns
8a3628f Set PYTHON using ?= syntax
8f6e8cf Print line number with data file error
3b06f22 Replace asserts with exceptions in generate_test_code.py
c3521df Fix generate_test_code.py unit tests
0fa3504 Add missing MSVC typedefs
667f7f8 Fix generation of #line directives in Python 2
7776141 Don't generate lines with only whitespace
9b06f37 Give execute permissions to Python scripts
b73159d Remove white spaces caught by check-files.py
ddde34c Remove git conflict marker from test_suite_timing.function
7613534 Fix gcc-7 -Wformat-truncation warning
1ec7e6f Python3 compatible generate_test_code.py
78befd9 Rename generate_code.py -> generate_test_code.py
7eb5568 Set OS specific python executable name
b522929 Add support for per test suite helper functions
05d83fa Put parentheses around macro arguments
36e5fac Rephrase confusing function description
317efe8 Adapt new test gcm_bad_parameters() to on target testing changes
f0e42fb Add missing documentation and fix file doc strings
9540261 Incorporated code review comments
d61b837 Update unit tests for change in test suites code generator
b1c2d0f Use switch instead if if-else for dependency and expression checks.
d61a438 incorporate code review comment in embedded_test.function
663d470 Incorporate code review suggestions in mbedtls_test.py
599cd24 Update unit tests for code generator and make code generator more testable.
acc5473 Use FileWrapper class in place of file where line number is required
5e2ac1f Updated generate_code.py unit tests
4b54323 Unit test generate_copy.py
13c6bfb Gaurd test suite headers with suite dependency
8c4d5ba Update CMakeList.txt with new test suites code generator
cf32c45 Add missing headers and fix name change issues
1de892b Update code as old template and generator is replaced with new one
191e904 Replace old template and code generator with new ones. Keep names
975d97e Remove old test suite template and code generator script
2397bba Update test generator for use of struct for hex parameters
d30ca13 Combine hex parameters in a struct
5cfc068 Fix name conflict in function params after hexify/unhexify change
3e5d000 Update Greentea API header
47b4060 Fix RSA test suite bugged by hexify/unhexify change
392267a Fix missing data in the RSA test vectors file
b3a103c Put else in it's own line
d59391a Add support for sending hex parameters
46c9b1f Fix test functions and data after moving hexify/unhexify out
5e7f8df Print Greentea __testcase_name indicator for Greentea to mark the test
a57a420 Add hex parameter dispatch
184447e Add proper handling of hex data
f1aaec9 Intermediate hexify out change
9079170 Adapt code for scripting out hexify/unhexify code
3499a9e Add hex comparison function
0574632 Update Greentea client API calls
ee6c018 Unify test setup errors for sending to host
ec02448 Fix line no. directive
67735d5 Fix name conflict and implicit use of functions from string.h
7a0d84f On target test host test script
fff4904 mbed-os test code generator
1f29be7 Make target for on mbed testing
94aefaf Optimise makefile targets
4481464 Adapt ChangeLog
5b559ac Fix mbedtls_ssl_get_record_expansion() for ChaChaPoly and CBC
9f7798e Revert change of a return variable name
b363382 Add ChangeLog entry for bug #1890
f1124c9 Merge remote-tracking branch 'public/pr/1891' into HEAD
1b9b217 enforce input and output of ccm selftest on stack
5f26b11 Change test dependencies to RC4 from DES
c796573 Add Chacha dependency to the stream cipher field
608a487 Fix memory leak in ecp_mul_comb() if ecp_precompute_comb() fails
6c34268 Merge remote-tracking branch 'restricted/pr/501' into development-restricted
f11a7cd Clarify Changelog entries
193c864 Update version to 2.12.0
37b9fd5 Merge remote-tracking branch 'restricted/pr/490' into development
34acd3c Merge remote-tracking branch 'public/pr/1868' into development
269e999 Remove unnecessary newlines in CONTRIBUTING.md
ee3ded0 Merge remote-tracking branch 'public/pr/1832' into development
729d781 Merge remote-tracking branch 'public/pr/779' into development
2c92949 Merge remote-tracking branch 'public/pr/1198' into development
c88c627 Merge remote-tracking branch 'public/pr/1658' into development
4ed32d0 cpp_dummy_build: Add NIST key wrapping header
488fd08 Add aes KW OIDs as defined
8dd03cd Add tests for the nist key wrapping feature
9cf0d53 Add ChangeLog
9ab746c Add selftests
cb349ac Implement the KW and KWP algorithm
466a57f Key wrapping API definition
5ca06c7 Merge remote-tracking branch 'public/pr/1724' into development
fb3b032 Merge remote-tracking branch 'public/pr/919' into development
ccb43df Merge remote-tracking branch 'public/pr/927' into development
dad05b7 Merge remote-tracking branch 'public/pr/1844' into development
0533054 Revise ChangeLog entry for empty data records fixes
c9a5f02 Move comment to a separate line
116ac43 Merge remote-tracking branch 'public/pr/1852' into development
bdf80d0 Merge remote-tracking branch 'public/pr/1810' into development
463928a Fix code formatting
fced1f2 Merge remote-tracking branch 'public/pr/1854' into development
ecb635e Add ChangeLog entry for #1098 fix.
428cc52 Allow to forward declare of public structs #1215
4072aae Merge remote-tracking branch 'public/pr/1875' into development
a7b3543 Merge remote-tracking branch 'public/pr/1871' into development
6965f77 Fix use of Knowledge Base in documentation
4736e96 add myself to changelog
ca2ea4e Fix issue if salt = NULL and salt_len !=0 in mbedtls_hkdf_extract()
5a5d03f Add test guidelines to CONTRIBUTING.md
10f9663 Added clarification to CONTRIBUTING.md
5cf4d06 Refine the definition of net_sockets.h
cce68be Add a macro to define the memory size in ssl_server2.c
e459f07 Correct logic to exclude i386 inline assenbly when -O0
8e6a22a Add additional i386 tests to all.sh
7a6da6e Expand i386 all.sh tests to full config ASan builds
ccbd464 Increase the memory buffer size for ssl_server2.c
4c761fa Add test for empty app data records to ssl-opt.sh
81f0633 Add ChangeLog entry for empty app data fix
ce6fbac Fix ssl_client2 to send 0-length app data
1a7a17e Check for invalid short Alert messages
3481792 TLSv1.2: Treat zero-length fragments as invalid, unless they are application data
b512bc1 CBC mode: Allow zero-length message fragments (100% padding)
7870ec1 Add API/ABI section to CONTRIBUTING.md
7c1258d all.sh: Return error on keep-going failure
7d728bd Merge remote-tracking branch 'public/pr/1454' into development
922bd1e Merge remote-tracking branch 'public/pr/1752' into development
862e703 Merge remote-tracking branch 'public/pr/921' into development
be685ba Merge remote-tracking branch 'public/pr/1836' into development
4f37bca Fix ChangeLog entry for issue #1663
df15356 Merge remote-tracking branch 'public/pr/1663' into development
fad5470 Merge remote-tracking branch 'public/pr/532' into development
a72098b Merge remote-tracking branch 'public/pr/1778' into development
ca33caf Add definition of purpose and use of networking module
0011503 Repharse comments
6ca436a Update change log
830ce11 Clarify attack conditions in the ChangeLog.
21feae5 Update change log
a47911c Fix memory leak in ssl_setup
0e2c07e Remove unnecessary mark as unused #1098
8744a02 Clarify a few comments
4b9a3ad Disable use of the i386 assembly for option -O0
00af447 Add ChangeLog entry for PR #536
e7aeef0 Merge remote-tracking branch 'public/pr/536' into development
32b0747 Merge remote-tracking branch 'public/pr/1737' into development
727325b Merge remote-tracking branch 'public/pr/1788' into development
24c0dbf Merge remote-tracking branch 'public/pr/1821' into development
cdbb2f2 Merge remote-tracking branch 'public/pr/1563' into development
231d7e5 Add ChangeLog entry for PR #1567.
6331cb0 Fix some whitespace issues in ChangeLog and CMakeLists.txt
d21bd31 Merge remote-tracking branch 'public/pr/1567' into development
6a25cfa Avoid debug message that might leak length
a5fbfd7 Enable snprintf on FreeBSD
a61d123 Minor changes to comments in hkdf.c
cdb5cc5 tests: dhm: Rename Hallman to Hellman
7b42030 Add counter-measure to cache-based Lucky 13
1cc1fb0 Fix Lucky 13 cache attack on MD/SHA padding
382c1db Minor fixes
d50f786 Update the CONTRIBUTING.md file for LTS branches
21f9afe Remove the namespacing from config-no-entropy.h
5ffc220 Documentation error in `mbedtls_ssl_get_session`
991f9fe all_sh: add a check for header inclusion in cpp_dummy_build.cpp
05fa46e Add ChangeLog entry for #992 fix
13dfb4e Revert changes in the configs folder
3fa6c27 Move definition to cipher.h
da2a312 Add entry in ChangeLog
ab8d58c Move definition of MBEDTLS_CIPHER_MODE_STREAM
a931265 Fix ssl-opt.sh not starting when lsof is not available
61fa436 Address review comments - tidy usage of macros to use minimal values
104d858 Add ChangeLog entry
5a9cb61 Use preserve mode to copy headers.
dcae78a Make a buffer limit more specific
470dfba Simplify OID tag parsing in x509_get_cert_ext( )
643df7c Update ssl-opt.sh test to run condition
1ab9b57 Add a ChangeLog entry for memory leak in mbedtls_x509_csr_parse()
034e139 Merge remote-tracking branch 'public/pr/1621' into development
4b6b08e Merge remote-tracking branch 'public/pr/1006' into development
1d97cab Merge remote-tracking branch 'public/pr/1645' into development
bea00bd Merge remote-tracking branch 'public/pr/1783' into development
9e02b97 Add ChangeLog entry for #1257 - key_app_writer writes invalid ASN.1
b056dd8 Remove a redundant dependency clause
19c01ef Merge remote-tracking branch 'public/pr/1258' into development
fd0c240 Merge remote-tracking branch 'public/pr/1793' into development
58093c8 Add ECC extensions test in ssl-opts.sh
05be06c Make the C++ test mandatory by removing the --no-cxx flag from all.sh
45a6719 Add a CXX build to all.sh to execute the C++ dummy test by default
037ec4b Replace tabs with spaces
89c048c Tests: add a test for cpp linking
0211c32 Change the cpp test to be optional
40741f8 Add a test with a cpp executable including all mbed TLS headers
84e62f8 Update ChangeLog
d56654f Update the forum link in the README file
6665b67 Merge remote-tracking branch 'public/pr/1390' into development
9fa21bf Merge remote-tracking branch 'public/pr/1533' into development
95a1c1f Merge remote-tracking branch 'public/pr/1617' into development
bf47099 Adjust to new RSA infrastructure
a522147 Fix compilation errors after updating
4922123 Update the Mbed TLS forum link
7972334 Enable ARIA self test in the unit testing
164b9cd update ChangeLog
b7d39db update ChangeLog
99a3e80 update change log.
1555085 add ChangeLog to this commit.
2682edf Fix build using -std=c99
512b4ee Use gmtime_r to fix thread-safety issue, and use mbedtls_time on Windows
8ee2422 about a issue Replace "new" variable #1782
51d7cfe Fix coverity warnings in benchmark.c
6c34442 Add fix for #1550 and credit to the ChangeLog
6332e36 Fix typo in ChangeLog
6fd941f Remove unneeded namesapcing in header files
7a81426 Fix style issue
6a9257b Add check for return code of bignumber code
5357164 Add ebx to the i386 clobber list for MPI assembly
bf7fe4f Replace check with APPLE with CMAKE_SYSTEM_NAME
5b92352 Document ssl_write_real() behaviour in detail
7ee25d7 Allow 0 as a valid ret value for mbedtls_ssl_write
a562c26 Add ChangeLog entry for mbedtls_ssl_write() docs
3f38cf7 Add entry in ChangeLog
755bb6a Add ecc extensions only if ecc ciphersuite is used
e3402ce Enable APPLE_BUILD in makefile if using system ar
7994766 Fix usage of if_build_succeeded in all.sh zeroize test
21f73b5 Coding style
c51d613 Ensure crosscompiling with make works in Mac OS X
e12f0ac Adapt buffer size for minimal CCM config
1f092b4 Add ChangeLog entry for ChachaPoly ciphersuites
9fece7e Add ChachaPoly ciphersuites to compat.sh
2e58e8e Implement ChachaPoly mode in TLS
c36b432 Add GnuTLS interop for CCM(-8) ciphersuites
ce66d5e Declare ChaCha-Poly ciphersuites
f57bf8b Define specific mode for ChachaPoly
a18034a Adjust to added fields in cipher_base_t
0dadba2 Merge branch 'development' into iotssl-2257-chacha-poly-primitives
8266aca Merge remote-tracking branch 'upstream-restricted/pr/487' into development
2fcd3e4 Change the library version to 2.11.0
925568a Fix version in ChangeLog for fix for #552
c4dd073 test: Add test cases for separately reduced inward/outward buffer sizes
d8213d0 Let MBEDTLS_SSL_MAX_CONTENT_LEN to be split into outward & inward sizes
b6a5bff Add ChangeLog entry for clang version fix. Issue #1072
c7bc9e1 Fix a few typos
cbe248a Merge remote-tracking branch 'public/pr/1727' into development
1f91575 Merge remote-tracking branch 'public/pr/1681' into development
688a456 Merge remote-tracking branch 'public/pr/1734' into development
cdc338b Merge remote-tracking branch 'public/pr/1735' into development
2711ad7 Merge remote-tracking branch 'public/pr/1736' into development
600c5e6 Compilation warning fixes on 32b platfrom with IAR
d9c71da Revert "Turn on MBEDTLS_SSL_ASYNC_PRIVATE by default"
2dbecc0 Merge remote-tracking branch 'public/pr/1602' into development
66a8903 Fix for missing len var when XTS config'd and CTR not
9873696 Merge remote-tracking branch 'public/pr/710' into development
5f57f1e Merge remote-tracking branch 'public/pr/1270' into development
6755905 Merge remote-tracking branch 'public/pr/1602' into development
d5d983e ssl_server2: handle mbedtls_x509_dn_gets failure
6b9bcd6 Remove redundant ret = 1 in dh_client.c
eb8bca6 Add missing platform macro defines in cert_app.c
bce5f78 Add missing platform macro defines in pk_decrypt.c
7d42965 Fix typo in platform macro defines for examples
28abd8e Fix ret code in gen_random_havege.c
25b5af5 Fix ret code in rsa_encrypt.c
7fe4edf Fix ret code in rsa_decrypt.c
7a9d01c Fix ret code in cert_app.c
dabd78f Fix ret code in generic_sum.c
9f3379d Fix ret code in pk_verify.c
82b2726 Fix ret code in pk_sign.c
0a7522c Fix ret code in pk_encrypt.c
5289817 Fix ret code in pk_encrypt.c
f47c9c1 Fix ret code in ecdh_curve25519.c
d905db6 Fix ret code in mpi_demo.c
78dabe0 Fix ret code in pem2der.c
357b0b2 Fix ret code in ssl_cert_test.c
80081a6 Fix ret code in udp_proxy.c
57a0c9b Fix ret code in req_app.c
898b208 Fix ret code in crl_app.c
f9a54d3 Fix ret code in cert_write.c
aacd928 Fix ret code in cert_req.c
67a42ac Fix ret code in ssl_mail_client.c
4be53b5 Fix ret code in ssl_fork_server.c
5517202 Fix ret code in ssl_client1.c
73d4a5f Fix ret code in gen_random_ctr_drbg.c
55a0d56 Fix ret code in gen_entropy.c
a833263 Fix ret code in rsa_verify_pss.c
0a860f6 Fix ret code in rsa_verify.c
3c41e56 Fix ret code in rsa_sign_pss.c
1a66056 Fix ret code in rsa_sign.c
70e1ffd Fix ret code in rsa_genkey.c
ed68488 Fix ret code in key_app_writer.c
0faf1a5 Fix ret code in key_app.c
208c217 Fix ret code in gen_key.c
2602a1f Fix ret code in ecdsa.c
03a992c Fix ret code in dh_server.c
d6bfeff Fix ret code in dh_genprime.c
898841d Fix ret code in dh_client.c
4c47df6 Fix ret code in crypt_and_hash.c
388c1b1 Fix ret code in aescrypt2.c
ace0592 Fix harmless use of uninitialized memory in ssl_parse_encrypted_pms
c306a05 SSL async tests: add a few test cases for error in decrypt
4481744 Fix memory leak in ssl_server2 with SNI + async callback
e247989 SNI + SSL async callback: make all keys async
2636fad ssl_async_resume: free the operation context on error
f5a9996 ssl_server2: get op_name from context in ssl_async_resume as well
ef30742 Clarify "as directed here" in SSL async callback documentation
7457933 SSL async callbacks documentation: clarify resource cleanup
3dae1cf Async callback: use mbedtls_pk_check_pair to compare keys
a668c60 Rename mbedtls_ssl_async_{get,set}_data for clarity
02b86d0 Fix copypasta in the async callback documentation
166ce74 SSL async callback: cert is not always from mbedtls_ssl_conf_own_cert
d6fbfde ssl_async_set_key: detect if ctx->slots overflows
0798158 Fix missing continuation indicator in ssl-opt.sh
20e2bdf SSL async tests: tighten a few log checks in some test cases
94e153a Improve documentation of the async callback's crypto parameters
37d4175 Add test case for SSL async resume after resume
4d9ec4d Fix uninitialized variable in ssl_server2
6331d78 Don't use the printf format %zd
03af7f6 Change boolean bitfield to unsigned
ff2f493 config: List cipher modes in alphabetical order
4ab8acd Merge remote-tracking branch 'public/pr/1075' into development
6ac1cf6 Merge remote-tracking branch 'public/pr/1182' into development
e5cd868 Add ChangeLog entry for PR #1555
c1bf1aa Merge remote-tracking branch 'public/pr/1555' into development
73a4b80 Merge remote-tracking branch 'public/pr/1672' into development
9a8db56 Merge remote-tracking branch 'public/pr/1730' into development
2ff0e52 Fix missing preprocessor condition in AES self-test
c03059d Simplify code in mbedtls_x509_csr_parse
0a8352b Fix harmless use of uninitialized memory in ssl_parse_encrypted_pms
725f1cb SSL async tests: add a few test cases for error in decrypt
3f3ada8 Fix memory leak in ssl_server2 with SNI + async callback
157f6d8 SNI + SSL async callback: make all keys async
d906b81 tests: cipher: Allocate enough space for XTS keys
0931708 benchmark: Add comma at end of help message
f4474e7 ChangeLog: Add an entry for AES-XTS
ed91a79 config: Update documentation for XTS option
c28012a tests: Remove NIST AES-XTS test vectors
142383e aes: xts: Add tests for invalid key sizes
8cfc75f aes: xts: Fix style issues with gf128mul
5f0b06a aes: xts: Fix description of gf128mul
f167deb aes: xts: Add a reference to the standard
c653990 cipher: Add wrappers for AES-XTS
425382d tests: Extend AES-XTS suite
e5c4b07 tests: Make AES-XTS suite more stack friendly
21d79cf aes: Add self test for AES-XTS
cd9fc5e aes: xts: Rename iv to data_unit
d82cd86 aes: xts: Rewrite to avoid use of goto
0a8b020 aes: xts: Enforce NIST SP 800-38E data unit size
5162b93 aes: Use length instead of bits_length in XTS
9366feb aes: xts: Add new context structure
e22ba80 Add XTS test suites to the Makefile
e9ecf00 aes: Remove AES-XEX
010c2cb gf128mul: Inline instead of making a new module
97cc3b1 gf128mul: Remove the jump table
5f77801 Implement AES-XTS mode
380162c Double perf for AES-XEX
daf7045 Add benchmark for AES-XEX
8bb817a Add AES-XEX to the version features
9bbe363 Rename exported symbols to please check-names.sh
fb67fae Add AES-XEX tests cases
75e3661 Add AES-XEX mode to the default config file
0089d36 Implement AES-XEX mode
b053658 Add 2 files for multiplication in GF(128)
9f52aeb tests: Fix name of 33 byte AES cipher tests
1d93759 Conditionally assign APPLE_BUILD var in makefile
c471cd7 Autodetect if running on OS X in makefile
7decfe8 Convert mbedtls_free and mbedtls_calloc into functions
9b04e19 Use grep to detect zeroize test failures on GDB
c06c9ae Add alias APPLE make var of APPLE_BUILD
4ed3880 Fix ChangeLog whitespace errors and add entry for PR #1646
f3987b3 Add ChangeLog entry for CCM*
601144e Add entry to ChangeLog for PR #795
b11de30 Fix braces in mbedtls_memory_buffer_alloc_status()
ae4cafa Merge remote-tracking branch 'public/pr/795' into development
c7638fa Fix ChangeLog entry after merge of HKDF
e47d6fd Merge remote-tracking branch 'public/pr/1497' into development
ebe23ed Fix up the ChangeLog for the new version
f0d7629 Merge remote-tracking branch 'public/pr/1593' into development
ebb6427 Merge remote-tracking branch 'public/pr/1646' into development
263498a Merge remote-tracking branch 'public/pr/1667' into development
dbe80c6 Merge remote-tracking branch 'public/pr/1668' into development
0b11e75 Merge remote-tracking branch 'public/pr/1692' into development
3cde2fc ssl_async_resume: free the operation context on error
4844bf2 Add OFB as additional block mode
cb2c935 aes: Clarify IV requirements for OFB mode
5db1362 Clarify documentation for AES OFB
33cb519 Add decrypt tests to AES OFB Cipher module
b7836e1 Change AES OFB tests to memset sizeof buffer
e416bf9 Reduce stack usage for AES OFB tests
968646c Clarify comments on use of AES OFB block mode
0013144 Fix style and formatting for OFB feature
374bcd4 Add to OFB cipher tests AES-192 and AES-256 OFB
dbe7fbf Remove unused variable in AES OFB test suite
6873c84 Update cipher.h for OFB block mode documentation
ad4e493 Fix AES-OFB support for errors, tests and self-test
7487c5b Add missing OFB entry to null ciphersuite
8c0fd1e Add cipher abstraction and test cases for OFB block mode
0301884 Add test cases for AES OFB block mode
76a5b22 Add OFB block mode to AES-128/192/256
10e0e4d hkdf: Add negative tests
3618962 hkdf: Add tests for extract and expand
798363e Add ChangeLog entry for HKDF
656864b Add an HKDF (RFC 5869) implementation
fcfa4c2 Merge remote-tracking branch 'public/pr/1699' into development
2a1edac Change symlink to hardlink to avoid permission issues
0a0e08a mbedtls_gcm_crypt_and_tag: clarify what each mode does and doesn't do
f30dbdc Update generated file
d75ee64 Fix out-of-tree testing symlinks on Windows
39b1904 Merge branch 'development' into iotssl-2257-chacha-poly-primitives
21a65e0 Fix usage of inline with for some compilers
2adb375 Add option to avoid 64-bit multiplication
80f679b Correct and clarify the documentation of GCM whole-message functions
c041435 Merge remote-tracking branch 'public/pr/1694' into development
d5a09f1 Updated version number to 2.10.0 for release
390641e Merge remote-tracking branch 'public/pr/1693' into development
b5b2543 Fix undefined shifts
ab72727 Add a disabled CMAC define in the no-entropy configuration
1a8ef07 Fix coverity defects
33dd323 Merge remote-tracking branch 'public/pr/1690' into development
d08a2f7 Adapt the ARIA test cases for new ECB function
747fd53 Fixes different off by ones
10438e1 Merge remote-tracking branch 'public/pr/1683' into development
6e962b2 Fix file permissions for ssl.h
d0e55a4 ssl_decrypt_buf: remove code for hashes that aren't used in TLS
94175a5 Refresh generated file
d2db09f Fix typo in documentation
9c82e2c Fix some whitespace issues
e533b22 Fix ordering and repetitions in config.h
3dc62a0 chachapoly: force correct mode for integrated API
26c3b0a Fix return type of internal function
5c38984 Use our habitual INTERNAL_ERROR debug message
a7fe25d Remove tests of #define's that don't exist
1bd9d58 Clarify comment about integer division by a variable
eb6ed71 Merge remote-tracking branch 'public/pr/1267' into development
2041a31 Merge remote-tracking branch 'public/pr/1402' into development
246cb05 Merge remote-tracking branch 'public/pr/1410' into development
b02f789 Merge remote-tracking branch 'public/pr/1470' into development
ba91994 Merge remote-tracking branch 'public/pr/1604' into development
d72700a Add ChangeLog entry for PR#1651
8edf2a3 Merge remote-tracking branch 'public/pr/1654' into development
02b9329 Fix MSan build without MBEDTLS_TIMING_C
0daf4ca Add test vectors for CCM*
4c57939 CCM*: Remove superfluous braces
143b319 CCM*: Make documentation consistent
20b4408 Fix Lucky13 attack protection when using HMAC-SHA-384
997e85c CCM*: Remove nested if
6b4bd3d CCM*: Improve documentation
95ab93d CCM*: Add minimal tests
b5734a2 CCM*: Add implementation
5dc8cfa CCM*: Add public API
45b79cf Treat warnings as errors for IAR
e7d3f8e Fix MicroBlaze register typo.
be78b07 chachapoly: warn against piecewise decryption
fa0c47d Fix typo in doc and copy missing warning
f4f01b6 Check return values from lower modules
1729789 Misc style adjustments
98fae6d ChaCha20: move working state from ctx to stack
9620f9b Rm mbedtls_ prefix form static functions
c22e61a Add ifdef for selftest in header file
fb78c90 Use recently-introduced platform_util module
39f2561 Fix edit mistake in cipher_wrap.c
3798b6b Add some error codes and merge others
234e1ce cipher: add stream test vectors for chacha20(poly1305)
32902e6 cipher: handle ChaCha20 as a stream cipher
c0dfcd4 Simplify selftest functions using macros
ceb1225 chachapoly: add test for state flow
444f711 poly1305: add test with multiple small fragments
59d2c30 chachapoly: add test for parameter validation
a8fa8b8 poly1305: add test for parameter validation
2aca236 chacha20: add test for parameter validation
fce88b2 Fix selftest verbosity in test suites
69767d1 cipher: add chachapoly test vector + unauth case
1465602 poly1305: fix bug in starts() and add test for it
55c0d09 chacha20: fix bug in starts() and add test for it
7296771 chachapoly: add test with unauthentic data
528524b Reduce size of buffers in test suites
d6aea18 Add Chacha20-Poly1305 to benchmark.c
b8bd80a Add FEATURE_NOT_AVAILABLE error codes.
5ef92d3 chachapoly: adjust parameter order
b1ac5e7 poly1305: adjust parameter order
b500f8b Update documentation to match new guidelines.
fe725de cipher: use new functions from chachapoly
346b8d5 chachapoly: split crypt_and_mac() to match GCM API
56206c4 Remove semi-internal chacha20_keystrem_block()
502f189 ChaCha20: allow in-place en/decryption
dca3a5d Rename aead_chacha20_poly1305 to chachapoly
4edd51b Rename poly1305_setkey() to poly1305_starts()
b7e9900 Avoid using %zu in selftest functions
823b7a0 Add missing extern "C" guard to new headers
95d0bdb Adapt the _ALT style to our new standard
ce8314f Add ChangeLog entry for new features.
e6e7968 Minor style and formatting fixes.
b6897f6 Correct signedness of printf specifier in self tests
16b04ce Fix unused function warning under certain configurations.
dca6abb Fix test suite when GCM Is disabled, but AEAD_ChaCha20_Poly1305 is enabled.
6155cc8 Add ChaCha20 test vectors from RFC 7539
4d8f87b Add ChaCha20/Poly1305 ciphers to the selftest program
dedf4a3 Adjust verbose self-test output to match other ciphers.
8fe4701 Add ChaCha20+Poly1305 to the Cipher module
a310c5e Allow some parameters to be NULL if the length is 0.
b8025c5 Implement AEAD-ChaCha20-Poly1305.
adc32c0 Add Poly1305 authenticator algorithm (RFC 7539)
bd92062 Add ChaCha20 to the Cipher module
34b822c Initial implementation of ChaCha20
d0f143b Update CTR doc for the 64-bit block cipher
4f24e95 Update CTR doc for other 128-bit block ciphers
f584286 Slightly tune ARIA CTR documentation
e95092d Change the value of fno-sanitize-recover
a64fba4 Remove double declaration of mbedtls_ssl_list_ciphersuites
2f3a581 Merge remote-tracking branch 'public/pr/1178' into development
f889202 Merge remote-tracking branch 'public/pr/1434' into development
8a1b2c8 Update CTR documentation
8c75421 Add no symbols warning fix to ChangeLog
0e98e88 Silence no symbols warn on apple & Makefile
7f3ef27 silence "no symbols" warnings on apple clang
7124fb6 Use zeroize function from new platform_util
a3712be Merge branch 'development' into iotssl-1941-aria-ciphersuites
0960b80 Move to new header style for ALT implementations
c089312 Add ifdef for selftest in header file
2df4bfe Fix typo in comments
565e4e0 Use more appropriate type for local variable
08c337d Remove useless parameter from function
89924dd Wipe sensitive info from the stack
12e2fbd Style adjustments
d418b0d Fix typo in comment
9d41073 Fix typos from copy-pasting
4d393b9 Add check-files.py to travis.yml
2699de3 Add check-files.py to pre-push.sh
a07039c Add check-files.py to all.sh
10d9ce3 Add script for source integrity checking
c4bd8ec Merge remote-tracking branch 'upstream-public/pr/1446' into development
11999bb Fix minor code style issues
cdd97fd Merge remote-tracking branch 'upstream-public/pr/1433' into development
707e962 Update visualc project files
6087f20 Fix memory leak in mbedtls_x509_csr_parse
a331e0f Merge remote-tracking branch 'upstream-restricted/pr/421' into development-proposed
fb19399 Merge remote-tracking branch 'upstream-public/pr/1498' into development-proposed
09c4e7e Merge remote-tracking branch 'upstream-public/pr/1486' into development-proposed
54306c1 Add more SNI/DTLS tests
f77d3d3 Rename SNI/DTLS tests in ssl-opt.sh script
0b3f00c Avoid -Wformat-truncation warning on gcc7
276b9a6 ssl_server2: get op_name from context in ssl_async_resume as well
9ceae8b Clarify "as directed here" in SSL async callback documentation
ea5fab8 SSL async callbacks documentation: clarify resource cleanup
26d01bc Async callback: use mbedtls_pk_check_pair to compare keys
1febfef Rename mbedtls_ssl_async_{get,set}_data for clarity
6a8cb36 Fix copypasta in the async callback documentation
807d74a SSL async callback: cert is not always from mbedtls_ssl_conf_own_cert
0b53e24 ssl_async_set_key: detect if ctx->slots overflows
deda75a Fix missing continuation indicator in ssl-opt.sh
37289cd SSL async tests: tighten a few log checks in some test cases
20deb01 Improve documentation of the async callback's crypto parameters
12d0cc1 Add test case for SSL async resume after resume
9de55fa Fix uninitialized variable in ssl_server2
5bea9f6 Don't use the printf format %zd
7830073 Change boolean bitfield to unsigned
5ffe41c Turn on MBEDTLS_SSL_ASYNC_PRIVATE by default
ac5e8a3 Document that callbacks must not return arbitrary SSL errors
8f97af7 Don't pass the async config data to async callbacks
e141638 Finish writing an unfinished comment
a36ac4f New wrapper mbedtls_status_is_ssl_in_progress(ret)
0fd90dd ssl_prepare_server_key_exchange: clarify where the signature is written
2481a71 Doxygen formatting improvements
c912572 ssl_server2: merge redundant async_private_error=resume/pk
d326883 Document what the SSL async sign callback needs to do with RSA
ceb541b ssl_server2: rename delay in ssl_async_operation_context_t
22e695f Be more precise about when a variable is unused
ad28bf0 Documentation improvements
168dae8 Comment formatting and whitespace fixes
df13d5c Pass the SSL context to async callbacks
9b562d5 mbedtls_ssl_handshake_free: take the SSL context as argument
2e33337 Fix invalid data being accepted in RSA-decryption-based ciphersuites
b74a1c7 Rename MBEDTLS_SSL_ASYNC_PRIVATE_C to MBEDTLS_SSL_ASYNC_PRIVATE
f112725 Style and grammar fixes
12ab5d4 Don't shadow the variable p
b44692f Merge branch 'mbedtls_ssl_get_key_exchange_md_ssl_tls-return_hashlen' into tls_async_server-2.9
8491406 Remove preprocessor directives around platform_util.h include
6698d2f Fix style for mbedtls_mpi_zeroize()
56e06db Improve mbedtls_platform_zeroize() docs
708c5cb mbedtls_zeroize -> mbedtls_platform_zeroize in docs
d0ef468 Reword config.h docs for MBEDTLS_PLATFORM_ZEROIZE_ALT
bc7bdbf Organize CMakeLists targets in alphabetical order
21b376b Organize output objs in alfabetical order in Makefile
ca1d742 mbedtls_ssl_get_key_exchange_md_tls1_2: return hashlen
0329d72 SSL asynchronous decryption (server side): update ChangeLog
fcca9d8 SSL asynchronous decryption (server side): tests
2c6078e SSL asynchronous decryption (server side)
bcd98a5 ssl_parse_encrypted_pms refactor: prepare, decrypt, return
422ccab ssl_parse_encrypted_pms refactor: prepare for remote private key
d9bfcab SSL asynchronous signature: fix renegotiation tests
e630aed SSL asynchronous signature: ChangeLog entry
dbb14e0 all.sh: run ssl-opt.sh on ECJPAKE, SSL async
9d12b4c SSL asynchronous signature: turn off by default
60ee4ca SSL asynchronous signature: basic test of recovery after error
f9f15ae ssl_write_server_key_exchange refactor: don't use p at all
d3eb061 ssl_write_server_key_exchange refactor: minor cleanup
ebd30ae ssl_write_server_key_exchange refactor: ssl_resume_server_key_exchange
d04d292 Get rid of useless handshake field out_async_start
ab50f83 Improve documentation of async operation start callbacks
7ab013a ssl_write_server_key_exchange refactor: move signature_len out
1004c19 ssl_write_server_key_exchange refactor: don't use p in the signing phase
184a3fa ssl_write_server_key_exchange refactor: create ssl_prepare_server_key_exchange
3ce9b90 ssl_write_server_key_exchange refactor: remove dig_signed_len
3665f1d SSL asynchronous signature: test cases
4bf9a28 SSL asynchronous signature: first implementation
ebd652f ssl_write_server_key_exchange: calculate hashlen explicitly
e1efdf9 ssl_write_server_key_exchange: don't hard-code max hash size
e198df5 ssl_pick_cert: use the public key for can_do
9eb5e9a SSL asynchronous private key operation callbacks: test server
8bf79f6 SSL asynchronous private key operation callbacks: interface
59e83d9 Add conf parameter to mbedtls_ssl_handshake_free
fe1c093 ssl_write_server_key_exchange refactor: remove redundant variable n
81d4e89 Don't rely on private key metadata in SSL
e5b5bd7 Allocate a unique err code for MBEDTLS_ERR_AES_BAD_INPUT_DATA
3f7f817 Check invalid nc_off
14a8b59 Fix doxygen error for MBEDTLS_PLATFORM_ZEROIZE_ALT
c58787f Update docs for MBEDTLS_PLATFORM_ZEROIZE_ALT in config.h
3ea559e Fix alignment in makefile
eecea0e Update zeroize test to use mbedtls_platform_zeroize()
9644983 Add platform_utils and zeroize to visualc files
82934be Do not install zeroize program in CMakeLists
1f6301b Rename mbedtls_zeroize to mbedtls_platform_zeroize
904e1ef Make utils module part of the platform
ae8e306 Fix docs typos for zeroize related features/test
757cd72 Update license headers year and branding
42defd1 Improve docs for zeroize.c and test_zeroize.gdb
1e8ea5f Improve docs for mbedtls_zeroize() and add refs
6606d5c Add config.h docs for MBEDTLS_UTILS_ZEROIZE_ALT
1962405 Justify moving zeroize() to utils in ChangeLog
806f403 Improve detection of program exit code in gdb script
6e34e63 Fix style in programs/test/zeroize.c
7111a0d Change test_zeroize.gdb script breakpoint due to zeroize.c change
88f8f41 Move zeroize func call to end of program in zeroize.c
0bd4237 Fix formatting in utils.c file comment
ecd1891 Change mbedtls_zeroize() to prevent optimizations
2967381 Extend zeroize tests to multiple optimizations
24768bf Improve test_zeroize.gdb breakpoint
b1262a3 Allow compile-time alternate to mbedtls_zeroize()
e32df08 Remove individual copies of mbedtls_zeroize()
d0d7bf6 Add gdb zeroize test when compiling with clang
f2d1792 Document test_zeroize.gdb script
c6b0abd Fix alignment of Makefiles
9a65b1d Add utils.h ChangeLog entry
ddebc49 Add gdb script to test mbedtls_zeroize()
5ab74a1 Add programs/test/zeroize.c to test mbedtls_zeroize
614d9c0 Add a utils.h file that contains common functions
418527b Fix minor issues with command line options
c4ec716 Fix uninitialized var in check-generated-files.sh
dfeda48 Remove VS project files from deleted example apps
5121d4b Remove refs to VS6 from generate_visualc_files.pl
4c1e2ec Check generated-visualc-files in check-generated-files
3c5f949 genereate_visualc_files.pl deletes old files
60bc47d library: Port to Haiku.
8339c8f x509.c: Remove unused includes
df60856 Only redefine _WIN32_WINNT macro when < 0x0501
7869680 Updated abi_check.py docstrings
fe60132 Move a buffer size test before the first relevant read
c33c7c8 Copy DartConfiguration.tcl, needed for make memcheck
533407a Use "#!/usr/bin/env perl" as shebang line.
8d54c06 Use correct version of snprintf on Windows
be03836 Fix some comments regarding what files are symlinked
b2f09c3 Support out-of-tree testing with CMake: add ChangeLog entry.
0114ffc all.sh: Verify out-of-tree testing with CMake
a71d64c all.sh: fix cleanup happening during an out-of-tree build
31b07e2 all.sh: be more conservative when cleaning up CMake artefacts
8405257 Support out-of-tree testing with CMake
38d8165 all.sh: add opposites to all boolean options
8a244c9 all.sh: option parsing: reduce vertical spread
2623296 all.sh: with --no-armcc, don't call armcc from output_env.sh
a6f430f Fix current directory check
127c5af Add copyright to abi_check script
7c2dd58 Add script for ABI compatibility checking
ce5673c Add reference to github issue in compat.sh
b4ef45b all.sh: build with -O -Werror in the full config
df761d5 Fix build with gcc -O -Wall
366e1b0 aria: fix comment on aria_a function
977dc36 aria test suite: uniformize line wrapping
f6b787c Fix typo in documentation (CTR warning)
2166214 aria: improve compiler compat by using __asm
2078725 aria: check arm arch version for asm
8abc349 aria: rationalize buffer sizes in test functions
d82d791 aria: fix more whitespace
906bc90 aria: number of rounds is non-negative
7fc0879 aria: more whitespace fixes
5ad88b6 aria: define constants for block size and max rounds
3c80009 aria: add error codes for hw implementations
f3a46a9 aria: fix some typos in comments
c0bb66f aria: improve compiler inline compatibility
22997b7 block ciphers: improve CTR nonce warning
5aa4e3b aria: align documentation on AES
4231e7f Fix some whitespace and other style issues
fdd4354 config.h: SSL no longer uses ciphers directly
525168c aria: expand config.h entry: ciphersuites & caller
08d1e91 aria: add ChangeLog entry
2268b96 aria: disable by default in config.h
26b54fa aria: document optional asm usage in config.h
377b2b6 aria: optimize byte perms on Arm
fb0e4f0 aria: optimise byte perms on Intel
cac5008 aria: define P3 macro
f205a01 aria: comment implementation of A transform
35ad891 aria: internal names closer to standard document
64744f8 aria: define SLA() as sl(a())
8c76a94 aria: turn macro into static inline function
62e813c Add aria to benchmark program
a41ecda aria: closer to usual comment style
5645393 aria: use mbedtls_zeroize()
c76ceb6 aria: move conditional outside of loop
9cc8924 aria: use unsigned type for bit count
e1ad749 aria: clean up interface of internal macros
a6d639e aria: improve some comments & internal names
442f03b cmake: keep test list in alphabetic order
6b36892 Add compat.sh ARIA run to all.sh
bba6406 compat.sh: add remaining ARIA suites
af37f0f Add remaining ARIA suites to priority list
9decaf5 Document Aria suites as TLS 1.2-only
4db944c Don't declare unsupported ciphersuites
7299dfd compat.sh: add ARIA interop tests with OpenSSL
a0e4708 compat.sh: add self-interop tests for ARIA suites
392c2d2 compat.sh: run 1.2-only tests with DTLS too
841192b fixed a macro to uppercase for a test script (.._TLS_DH_anon_WITH.. -> _DH_ANON_WITH_)
c06e101 ARIA ciphersuites for TLS 1.2
07478d6 something to do with whitespaces
0fb47fe MBEDTLS_ARIA_ALT added as a feature
8df81e0 Test suite for ARIA
6ba68d4 ARIA init and free
3c0b53b ARIA build integration
259fa60 ARIA test vectors for CBC CFB CTR modes
41efbaa ARIA cipher implementation
0afe624 all.sh: add test with MBEDTLS_DEPRECATED_REMOVED
bb51cb3 remove additional zero byte when writing pub der
3d8c907 Compute outgoing MAC in temporary buffer for MAC-then-Encrypt
3f8271e Support only new CLang version
18b3c91 Address Azim's coments
22d989c Suport clang version 3.8
0049f78 check matching issuer crt and key for all algs
9839360 Fix all.sh check_tools function to handle paths
1a83445 Add SNI with DTLS tests to ssl-opt.sh script

git-subtree-dir: third_party/mbedtls/repo
git-subtree-split: 76dc0659f649d5d0eda0ff34322fb3ba7e6492cf
2018-11-02 15:36:26 -07:00
Jeff Bumgardner 8a94ede247 [docs] added link for OpenThread China and updated Doxygen TOC (#3261) 2018-11-02 14:48:20 -07:00
Yakun Xu e914c6ab6a [docs] add otUdpSend() usage (#3220) 2018-11-02 11:28:07 -07:00
Zhanglong Xia e2abb405c2 [clang-format] add diags to make pretty (#3252) 2018-11-01 21:37:46 -07:00
Zhanglong Xia 2aed617140 [tlv] update channel related TLVs to process channel page (#3240) 2018-11-01 21:35:53 -07:00
Yakun Xu 92bcf61a8e [link-raw] fix radio with multiple transmit buffers (#3239) 2018-11-01 21:34:51 -07:00
Sergey Polyakov 706b393a7b [mac] make sure network name is always updated (#3246) 2018-11-01 10:23:32 -07:00
Sergey Polyakov 53ff24a6b4 [mac] make sure network name is always null-terminated (#3246) 2018-11-01 10:23:32 -07:00
Yakun Xu 0743816acd [posix-app] unsupported radio file error (#3247) 2018-11-01 09:11:30 -07:00
Abtin Keshavarzian 9a7fc691b1 [mac] move "Mac::ChannelMask" to its own files "mac/channel_mask.hpp|cpp" (#3244) 2018-11-01 09:04:46 -07:00
Jonathan Hui 5c1aec2299 [cli] fix typo in CoapSecure (#3243) 2018-11-01 09:01:54 -07:00
rongli 1d617b9027 [thci] enhancements for ncp device (#3195)
- differentiate serial login scenarios and improve serial login experience
- shorten command sending and validating process
- fix ping issue (no impact on NCP DUT certification)
2018-11-01 08:38:39 -07:00
Yakun Xu f66753a469 [coaps] directly send DTLS message (#3232) 2018-10-31 13:47:13 -07:00
Jiacheng Guo 5f0791553a [clang-format] use cpp03 (#3194) 2018-10-31 12:31:09 -07:00
Yakun Xu aa0c3a7a70 [script] clang-format bootstrap on macOS (#3242) 2018-10-31 10:18:08 -07:00
Abtin Keshavarzian 728bd3e5a8 [mac] allow same operation to start from done callback handler (#3231)
This commit changes the `Mac` operation scheduling to allow
users to start a new operation from the done callback handler of
a previous operation. For example, calling `Mac::ActiveScan()`
from a previous `mActiveScanHandler` callback handler should
succeed.

This is realized by ensuring to call `FinishOperation()` before
invoking the done callback and after the callback, perform any
pending next operation by calling `PeformNextOperation()`.
2018-10-30 20:31:23 -07:00
Abtin Keshavarzian 3a4a61f7ca [radio] update "radio.h" documentations (#3230)
This commit updates the `radio.h` header file:
- Re-orders the definitions so keep the related functions close.
- Updates the documentation/comments.
- Uses `otPanId` and `otShortAddress` for function parameter types.
2018-10-30 12:24:52 -07:00
Abtin Keshavarzian 13fb20ed26 [mac] add "Mac::ExtAddress::GenerateRandom()" to create random address (#3228)
This commit adds method `GenerateRandom()` to `Mac::ExtAddress` to
generate a random IEEE 802.15.4 Extended Address. This method
replaces the `Mac` class `GenerateExtAddress()` method.
2018-10-30 12:23:32 -07:00
Łukasz Duda 014514442d [crypto] add support for ECDSA signing (#3218) 2018-10-30 12:23:10 -07:00
Joseph Newman e99ce0cf1f [efr32] implement otPlatTime* APIs (#3212) 2018-10-30 12:22:06 -07:00
Jonathan Hui cebfdbbeb3 [examples] change sInstance to instance (#3229) 2018-10-29 19:51:56 -07:00
Abtin Keshavarzian 9f2c56e620 [posix-app] check RCP capabilities and add support for stream log (#3215)
This commit contains the following changes:

- It adds code to `RadioSpinel::Init()` to get and check the RCP
  capabilities (`SPINEL_PROP_CAPS`) ensuring RCP supports radio/raw
  mode (`SPINEL_CAP_MAC_RAW`).

- It adds support for handling stream log `SPINEL_PROP_STREAM_LOG`
  property from RCP.

- It moves the existing code checking spinel version and radio
  capabilities of RCP into helper methods `CheckSpinelVersion()`
  and `CheckRadioCapabilities()`.
2018-10-29 19:50:25 -07:00
Abtin Keshavarzian a1a67fd2b6 [mac] use direct callbacks into mesh forwarder for send/recv (#3214)
This commit changes `Mac` implementation to use direct callbacks into
`MeshForwarder` to inform it of a frame reception or status of a
requested frame transmission. This changes replaces the `Mac::Sender`
and `Mac::Receiver` model.
2018-10-29 19:49:40 -07:00
Jonathan Hui 4452ed66e6 [cli] fix bug in printing coap peer address (#3227) 2018-10-29 12:40:52 -07:00
Yakun Xu 9551d0af7f [posix-app] fix typo of app logging (#3225) 2018-10-29 12:40:32 -07:00
Jonathan Hui d2b4da2dda [efr32] add missing instance header include (#3224) 2018-10-29 12:39:57 -07:00
Jonathan Hui 7c5b15c877 [style] apply clang-format-6.0 changes (#3222) 2018-10-29 12:38:06 -07:00
Jonathan Hui 5e4be05907 [style] change to clang-format-6.0 (#3222) 2018-10-29 12:38:06 -07:00
Yakun Xu dcc9b7e249 [coaps] fix disconnect in CoAP secure (#3221) 2018-10-29 12:37:24 -07:00
Abtin Keshavarzian bbd8b3466f [mac] simplify implementation of ENABLE_BEACON_RSP_WHEN_JOINABLE feature (#3216) 2018-10-26 14:58:10 -07:00
Jonathan Hui 980097c2ef [mbedtls] disable debug by default (#3217) 2018-10-26 13:05:28 -07:00
Łukasz Duda 34c6af0789 [coap] add support for Proxy-Uri option (#3211) 2018-10-25 21:10:16 -07:00
Łukasz Duda 52669a925a [coap] add support for CoAP header exceeding 255 bytes (#3210) 2018-10-25 21:08:17 -07:00
Łukasz Duda 597a81fd0a [dns] simplify defines name and clean up (#3209) 2018-10-25 12:58:29 -07:00
Łukasz Duda fe2a4974a6 [common-switches] add missing switches (#3208) 2018-10-25 12:57:55 -07:00
Łukasz Duda 9e1fa5957c [coap] remove unneeded namespace binding (#3207) 2018-10-25 10:21:34 -07:00
Yakun Xu 38ffdea2fe [posix-app] add option to print version of radio spinel (#3205) 2018-10-25 10:19:33 -07:00
Abtin Keshavarzian bfaa5c174d [posix-app] update default core config header file (#3204) 2018-10-25 10:18:06 -07:00
Kamil Sroka 71d9ba814c [nrf52840] update nRF52840 radio driver to version 1.2.2 (#3203) 2018-10-25 10:17:29 -07:00
Kamil Sroka 2446d36649 [nrf52840] fix possible permanent sleep in multiprotocol (#3202) 2018-10-25 10:16:40 -07:00
Abtin Keshavarzian 309bd09d75 [logging] remove aInstance as input parameter to logging macros (#3184) 2018-10-25 09:14:43 -07:00
Yakun Xu f0b5245f88 [platform-udp] fix processing message received from other interface (#3200) 2018-10-24 20:40:15 -07:00
Abtin Keshavarzian 1fa71a6ca2 [toranj] adding build script for different configs: ncp, rcp, posix-app (#3196) 2018-10-24 20:07:47 -07:00
Zhanglong Xia 8d440789ac [efr32] add a method to download image to specified EFR32 dev board (#3191) 2018-10-24 20:05:25 -07:00
Abtin Keshavarzian 6086e1a094 [core] add support for external OT vendor extension (#3183)
This commit contains the following changes:

- It adds a new configure option "--with-vendor-extension" allowing
  users to add a source file to be built along with OpenThread core
  library. `OPENTHREAD_ENABLE_VENDOR_EXTENSION` indicates whether
  this feature is enabled or not.

- It adds a class `Extension::ExtensionBase` which defines the hooks
  from OpenThread into the vendor extension module. Vendor extension
  code should inherit from this class and provide the implementation
  of the defined methods.

- A source file `extension_example.cpp` is added to provide an example
  on how to implement an OpenThread vendor extension.

- One of the build configuration under Travis CI posix target is
  updated to enable the vendor extension feature (using the example
  code) and verify the build.
2018-10-24 20:04:06 -07:00
Zhanglong Xia c0bfc9929b [efr32] enable platform efr32 to support dev board BRD4170A (#3189) 2018-10-23 22:26:58 -07:00
Zhanglong Xia af56b17bca [qos] rename message priority (#3159) 2018-10-23 15:14:49 -07:00
Yakun Xu 034e5ad03e [coverage] remove empty functions (#3179) 2018-10-23 09:55:30 -07:00
Abtin Keshavarzian a07751ec0d [travis] ensure to exit with error on toranj build failure (#3197) 2018-10-22 22:57:09 -07:00
Yakun Xu c58d9cc0b1 [border-agent] border agent state event (#3186) 2018-10-22 22:47:59 -07:00
rongli 04a2577cc6 [thci] fix paramiko scope issue when connecting to ncp device via ssh (#3192) 2018-10-22 22:31:57 -07:00
Yakun Xu 45567f515f [posix-app] remove pseudo reset (#3190) 2018-10-22 22:22:16 -07:00
e-rk ad610d8db8 [nrf52840] Add CCPREFIX variable to nRF52840 Makefile (#3182) 2018-10-22 21:22:42 -07:00
Shu Chen 71d4ad3e77 [nrf52840] fix the k802154Sync timer (#3181)
It may cause the issue that the timestamp provided by nrf_802154_received_timestamp_raw()
is not consistent with otPlatAlarmMicroGetNow().
2018-10-18 11:15:31 +02:00
Biswajit de1a3e6e32 [ncp] send Parent Response info on NCP FTD configuration (#3147) 2018-10-18 06:30:44 +02:00
Yakun Xu 72fa647805 [coaps] refine definition of CoapSecure::Connect (#3178) 2018-10-17 23:21:53 +02:00
Yakun Xu b0f84aa210 [coap] remove get port (#3177) 2018-10-17 23:18:55 +02:00
Yakun Xu c711dc9d0c [posix-app] support dry run (#3176) 2018-10-17 23:18:26 +02:00
Yakun Xu 465a46c4c8 [posix-app] clean headers in platform-posix.h (#3175) 2018-10-17 23:14:12 +02:00
Abtin Keshavarzian 4c6801ad73 [mac] invoke HandleTransmitDone from tasklet in case OT_ERROR_ABORT (#3173)
This commit re-uses the `mOperationTask` tasklet (in addition to it
being used for starting a scheduled MAC operation) to invoke the
`HandleTransmitDone()` in case of `OT_ERROR_ABORT` failure. This
ensures that frame retransmission attempt (in case of back-to-back
failures) are not done through the same long call chain.
2018-10-17 13:23:30 +02:00
e-rk 8a5b9fc5c0 [nrf52840] fix NCP radio not working on USB CDC UART (#3169) 2018-10-17 13:23:05 +02:00
Jonathan Hui 50bb212d86 [travis] add osx build check (#3164) 2018-10-17 13:22:35 +02:00
Abtin Keshavarzian 5b546fe22d [posix] add radio platform API to get/set tx power (#3152) 2018-10-17 13:22:16 +02:00
Yakun Xu a56666a6d0 [posix-app] define posix app exit code (#3156) 2018-10-16 20:05:57 -07:00
Abtin Keshavarzian 59545f5c61 [link-raw] retrasnmit frames on any error (#3172) 2018-10-16 19:59:55 -07:00
Jonathan Hui b13f22c03e [ip6] rename aEui64 to aExtAddress (#3171) 2018-10-16 19:58:50 -07:00
Shu Chen 71b90a6764 [time-sync] fix build issue with time sync enabled (#3167)
Also enable time sync in a travis check.
2018-10-16 19:58:34 -07:00
Yakun Xu 0b18d8ffad [settings] remove unused APIs (#3160) 2018-10-16 19:57:09 -07:00
Jonathan Hui 3fc9b95f81 [fuzz] exclude -fno-rtti when fuzzer is enabled (#3166) 2018-10-16 01:14:16 -07:00
Jing e18877210a [thci] conditionally import paramiko and change getting joiner state method (#3165) 2018-10-16 01:01:25 -07:00
Yakun Xu a2d0f97ae7 [macos] fix platform UDP on macOS (#3163) 2018-10-15 15:13:53 -07:00
Jonathan Hui 403ebf5c0c [docs] update txpower command (#3162) 2018-10-15 02:21:54 -07:00
Yakun Xu 232379a07c [posix-app] fix warnings on macOS (#3158) 2018-10-15 01:56:22 -07:00
Jonathan Hui ad50e4bedd [travis] fix scan-build check (#3155) 2018-10-15 01:51:28 -07:00
Yakun Xu 677d49b42e [posix-app] platform UDP (#3070)
This commit defines a set of platform APIs to integrate UDP layer of
OpenThread with that of the platform.

With this commit, services and applications developed upon OpenThread can
also be accessed through platform's own network interface, e.g. socket() on
POSIX.
2018-10-14 11:08:35 -07:00
Yakun Xu 8e7dba9e4a [posix-app] fix set radio spinel speed (#3157) 2018-10-14 10:59:23 -07:00
Abtin Keshavarzian 12fab0b98e [posix-app] exit on untimely RCP crash/reset (#3154) 2018-10-14 06:38:21 -07:00
Stuart Longland 7f6ecce258 [spinel] do not use glibc-internal header sys/cdefs.h (#3153)
The `sys/cdefs.h` is an internal header of `glibc` and is not meant to
be used by user code.  The macros needed from it can be trivially
implemented where required, relying on this header being present
excludes OpenThread from being used on systems where `glibc` is not the
used C library (e.g. OpenWRT, where `uclibc` or `musl` is standard).

https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-%3Ccode%3Esys/cdefs.h%3C/code%3E
2018-10-14 06:36:26 -07:00
Abtin Keshavarzian 9bf8d8169a [mesh-forwarder] add log for retry attempts of indirect tx to sleepy nodes (#3151) 2018-10-12 22:19:06 -07:00
Yakun Xu 3ef4641b36 [posix-app] verify radio capabilities (#3148) 2018-10-12 22:18:20 -07:00
Abtin Keshavarzian 3c88ba28fb [docs] specify seconds as the unit for child timeout value (#3145) 2018-10-12 22:16:36 -07:00
rongli 4c470d7eea [doc] add note for 'parent' command (#3142) 2018-10-12 22:16:16 -07:00
Jonathan Hui 868934b114 [dtls] include server only with commissioner or coaps (#3139) 2018-10-12 22:13:08 -07:00
Yakun Xu 98457ea65e [posix-app] always reset radio when init (#3149) 2018-10-12 13:19:08 -07:00
Jonathan Hui d64b889f52 [travis] add python3 to continuous integration (#3146) 2018-10-12 11:10:18 -07:00
Jonathan Hui 22dd0e0f7d [tests] add python3 support (#3146) 2018-10-12 11:10:18 -07:00
Jing a2865b57a2 [thci] fix channel mask format issue in wpanctl commissioner command (#3150) 2018-10-12 10:53:21 -07:00
Abtin Keshavarzian e6df05b7eb [posix-app] check spinel version of RCP from RaioSpinel::Init() (#3141) 2018-10-12 10:41:17 -07:00
Abtin Keshavarzian 7c8a37263b [posix-app] get RCP (NCP in radio mode) version (#3140)
This commit contains the following changes:

- It adds `otPlatRadioGetVersionString()` as an optional radio
  platform API. If the radio platform does not implement this
  function, OpenThread core provides a default weak implementation
  of this function which return the OpenThread version.

- A public OpenThread API `otGetRadioVersionString()` is added which
  provides the radio version string.

- POSIX App is updated to get the version from its RCP and provide
  `otPlatRadioGetVersionString()`

- A new spinel capability `SPINEL_CAP_POSIX_APP` is added which
  corresponds to `ENABLE_POSIX_APP` configuration.

- A new spinel property `SPINEL_PROP_RCP_VERSION` (only available
  in POSIX_APP) is added which gets the RCP version.
2018-10-12 10:40:57 -07:00
Yakun Xu 2457aa1864 [posix-app] remove dependency on stty (#3138) 2018-10-12 10:39:14 -07:00
Abtin Keshavarzian 467ab24e9b [mesh-forwarder] update indirect message logs (#3135)
This commit makes the following changes in `MeshForwarder`:

- It separates the logging of sent direct and indirect messages,
  ensuring that for indirect messages the status (success/failure)
  is logged after all retry attempts.

- It updates the log message (status of transmission) for a larger
  message requiring fragmentation and multiple frame transmissions
  when `CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE` is not enabled.

- It fixes managing of `IpCounters` to only account for messages
  with type `kTypeIp6`.
2018-10-11 10:07:11 -07:00
Jonathan Hui 739842d168 [travis] update to gcc-arm-none-eabi-7-2018-q2-update (#3134) 2018-10-11 10:06:11 -07:00
Yakun Xu 9ae76c1c67 [core] remove dependency on libstdc++ (#3130) 2018-10-11 10:05:51 -07:00
Zhanglong Xia 8e35bf1db8 [qos] reverse message priority level values (#3132) 2018-10-10 23:06:33 -07:00
Abtin Keshavarzian db3aa113cb [toranj] test-case to check child mode change and parent reset recovery (#3129) 2018-10-10 12:43:13 -07:00
Abtin Keshavarzian c5d611a366 [mle] save child info in settings on mode or timeout change (#3129)
This commit changes `MleRouter::HandleChildUpdateRequest()`:

- If the child entry is modified (i.e., timeout value or
  device mode changes) on an already attached child, the child
  info is updated and saved in the non-volatile settings.
  This ensures that after a parent reset the child can be
  recovered correctly.

- If the "Child Update Request" causes a mode change from rx-on
  to sleepy on a child in `kStateValid` (already attached), the
  source match controller is set to perform source address
  matching on the short address.

- This commit also adds a log to indicate mode change of a
  child.
2018-10-10 12:43:13 -07:00
Jeff Bumgardner e3a82139e3 [nrf52840] fix typo in log parameter (#3136) 2018-10-09 14:50:38 -07:00
Yakun Xu cddfda34cc [posix-app] map log level with syslog (#3133) 2018-10-09 11:15:00 -07:00
Yakun Xu 12171a1270 [meshcop] do not set joiner port in constructor (#3131) 2018-10-09 11:14:00 -07:00
Yakun Xu 2af44beb74 [posix-app] simplify saving settings (#3108) 2018-10-09 11:12:56 -07:00
rongli 5db4b0e295 [core] update first parent request with only R flag during downgrade (#3084)
This commit distinguishes the attach same process during downgrade from
the one caused by losing connectivity as for the former downgrade
scenario, there must be enough active routers to provide connectivity,
and additional benefits is to avoid the impact of possible flooding parent
responses if there are lots of REEDs in large scale thread network.
2018-10-09 10:55:51 -07:00
Jonathan Hui 2dea42cea6 [dhcp6] add dhcp6 server support to NCP (#3128) 2018-10-08 15:42:11 -07:00
Abtin Keshavarzian 461b1aec64 [toranj] adding test-026 for addition/removal of SLAAC IPv6 address (#3111) 2018-10-08 15:41:46 -07:00
Jonathan Hui 6282fcdeb0 [dtls] remove unnecessary member variable mClient (#3127) 2018-10-08 11:04:49 -07:00
Jonathan Hui a5dc13e3be [mbedtls] simplify config file (#3126) 2018-10-08 09:24:43 -07:00
Yakun Xu 92b9746787 [cli] fix initializing coap secure response (#3125) 2018-10-08 09:24:11 -07:00
Jonathan Hui b213628fd6 [travis] update to clang-6.0 (#3122) 2018-10-08 09:23:47 -07:00
Jonathan Hui 2f01fcc8d2 [configure] fix typo (#3121) 2018-10-08 09:23:36 -07:00
Abtin Keshavarzian ad3ea71c59 [posix-app] rename global variable to gNodeId (#3118)
This commit renames `NODE_ID` to `gNodeId` in posix app and  posix
platform example code. It also ensures to use correct encoding (byte
order) to calculate the `gNodeId` (as `uint64_t`) in posix app.
2018-10-08 09:23:13 -07:00
Abtin Keshavarzian 67f3880165 [spinel] add and use new capability NET_THREAD_1_1 (#3124) 2018-10-05 00:59:16 -07:00
Yakun Xu 3ac958441e [meshcop] add commissioner aloc (#3123) 2018-10-05 00:58:19 -07:00
Abtin Keshavarzian 94ac42eec9 [docs] fixing typos in comments/docs (#3120) 2018-10-05 00:56:55 -07:00
Abtin Keshavarzian abe64591c7 [posix-app] update the logging implementation (#3119) 2018-10-05 00:56:26 -07:00
Abtin Keshavarzian b8cfaa3afa [posix-app] remove unused global variables in system.c (#3117) 2018-10-03 23:22:35 -07:00
Abtin Keshavarzian 0c72bc426c [posix-app] remove unused debug_uart source file (#3115) 2018-10-03 23:21:53 -07:00
Abtin Keshavarzian d640d4a7f9 [link-raw] move the LinkRaw implementation to core from api folder (#3114) 2018-10-03 23:21:12 -07:00
rongli 97aafadf2c [thci] fix warning when set downgrade threshold for ncp device (#3113) 2018-10-03 23:20:24 -07:00
Jonathan Hui 1b200be545 [thci] fix IPv6 prefix format (#3116) 2018-10-02 23:12:38 -07:00
rongli 9f55322d36 [thci] fix preferred flag when config border router (#3112) 2018-10-02 02:34:58 -07:00
Jing a97b0c02af [thci] wpanctl thci firmeware validation and modify getGUA according to GRL change (#3106) 2018-10-01 23:52:06 -07:00
Jeff Bumgardner 3b3cca230a [docs] minor Doxygen fixes (#3110) 2018-10-01 23:13:41 -07:00
Jeff Bumgardner 1c9ddd8c15 [docs] update Windows 10 README (#3107) 2018-09-28 13:51:49 -07:00
Jonathan Hui 1ba69deb30 [coaps] add functional tests for psk and x509 (#3096) 2018-09-27 15:15:08 -07:00
Jonathan Hui 696a9441a9 [coaps] include coaps in make dist (#3096) 2018-09-27 15:15:08 -07:00
Abtin Keshavarzian 473c009879 [toranj] relax wpan state transition checks in test-100-mcu-power-state (#3103) 2018-09-27 13:35:53 -07:00
Yakun Xu eb2737189a [posix] add baudrate configuration for POSIX simulation (#3105) 2018-09-27 09:34:18 -07:00
Yakun Xu 2314a5603e [travis] fix typo of disable tests (#3104) 2018-09-27 09:33:40 -07:00
Jonathan Hui 5a489836cd [naming] rename FFD to FTD (#3102) 2018-09-27 09:33:03 -07:00
Abtin Keshavarzian 5e42a40911 [network-data] add MatchMode enumeration for how RLOC16 are matched (#3098) 2018-09-27 09:16:02 -07:00
Abtin Keshavarzian 00cac8002b [spinel] add spinel_command_to_cstr() and update strings (#3097) 2018-09-27 08:45:17 -07:00
Zhanglong Xia cc24aa8f76 [message] create new messages with priority (#3015) 2018-09-26 20:07:51 -07:00
Jing ea1b83a4e7 [thci] add SSH support for OpenThread wpanctl THCI (#3086) 2018-09-26 19:59:18 -07:00
Christian Stauffer be1641434b [cli] fix NULL pointer udp example cli, when udp called without args (#3101) 2018-09-26 07:23:44 -10:00
Yakun Xu 125991b566 [meshcop] verify border agent address is rloc (#3100) 2018-09-26 07:23:12 -10:00
Christian Stauffer 2ce47a8e9c [coaps] CoAP Secure Client/Server accessible through OT API (#2716) 2018-09-24 11:22:08 -10:00
Abtin Keshavarzian 5fe9038e33 [toranj] enable new mode "posix app and RCP" (#3091)
This commit updates `toranj` framework to allow a different mode of
operation where tests are run using posix-app along with an RCP (NCP
in radio only mode) build. This commit also adds a new job for the
new model in travis CI build matrix.
2018-09-24 09:43:19 -10:00
rongli 55bf9fc2fe [core] remove children when attached after receiving MLE Announce Messages (#3093) 2018-09-24 06:57:31 -10:00
Biswajit 06bff96310 [mle] API to provide MLE Parent Response information (#3027) 2018-09-21 18:28:41 -10:00
Yakun Xu 41d8e4a73b [ip6] revert allowing sending packet with hop limit 0 (#3092) 2018-09-21 12:31:13 -07:00
Abtin Keshavarzian 90178d3027 [toranj] add new test NetworkData timeout and entry removal (#3082) 2018-09-19 11:31:11 -10:00
Abtin Keshavarzian 75522066c1 [network-data] remove all matching entries from RemoveRloc methods (#3082)
This commit makes changes to ensure the `Leader::RemoveRloc` methods
remove all matching entries from a `BorderRouterTlv` or `HasRouteTlv`
It adds new methods to `BorderRouterTlv` and `HasRouteTlv` to get the
first entry or last entry and allow an easier way to iterate over all
the entries.
This commit also adds a new helper method `RlocMatch()` to simplify
the comparison of RLOC16 values (exact match vs router id match).
2018-09-19 11:31:11 -10:00
Abtin Keshavarzian b43d83f43f [network-data] check and validate received network data before registering (#3078)
This commit adds check in `Leader::RegisterNetworkData()`to validate
the received network data and ensure it only contains entries matching
the RLOC16 of the device registering the network data. It updates
`RlocLookup()` method to add a new mode to allow or not allow any
entries that do not match the given RLOC16.
2018-09-19 07:55:21 -10:00
Yakun Xu 8f03f2a714 [travis] fix android check for ndk upgrade (#3090) 2018-09-19 05:55:08 -10:00
Jeff Bumgardner 7f13a960a2 [docs] update OT logos for Test Harness use (#3088) 2018-09-18 20:06:22 -10:00
Jonathan Hui 5fb4423a6c [license] update license headers (#3081) 2018-09-18 06:44:58 -10:00
Yakun Xu 0a86cc99ef [posix] flash file permission to 600 (#3085) 2018-09-18 06:31:40 -10:00
Łukasz Duda 704511c96e [icmp6] pass Echo Request messages to user-defined callback (#3083) 2018-09-18 06:30:56 -10:00
Yakun Xu 136a444565 [ip6] allow hop limit 0 (#3077) 2018-09-18 06:29:50 -10:00
Kamil Sroka 7132effa91 [nrf52840] enable ECDSA in mbed TLS (#3080) 2018-09-17 06:30:37 -10:00
Abtin Keshavarzian b9d1cb3b20 [ncp] add support for SPINEL_PROP_PHY_RSSI property in radio only mode (#3075) 2018-09-15 11:42:55 -10:00
Abtin Keshavarzian f5c55c5e23 [poisx-app] fix delayed TxDone callback (#3074) 2018-09-15 11:42:33 -10:00
Yakun Xu a834a06dbd [posix-app] remove link file from posix-app (#3072) 2018-09-15 11:40:47 -10:00
Yakun Xu ed794337e7 [posix] enhance reset implementation to support code coverage (#3071) 2018-09-14 10:59:07 -10:00
Jonathan Hui a23f778e11 [tests] support python3 (#3068) 2018-09-14 10:58:40 -10:00
Abtin Keshavarzian 6618c5564d [toranj] new test to check partition formation and merging (#3066) 2018-09-14 10:58:26 -10:00
Yakun Xu 9c04586861 [posix-app] check energy scan capability (#3047) 2018-09-14 10:56:58 -10:00
Jonathan Hui 222acd1362 [windows] resolve uninitialized memory warning (#3073) 2018-09-12 22:26:45 -10:00
Yakun Xu 4ef65c1ccf [posix-app] add README for posix-app (#3052) 2018-09-12 20:27:03 -10:00
Jonathan Hui 39cd92c743 [build] conditionally build cli and ncp FTD/MTD/radio libs (#3067) 2018-09-12 20:17:17 -10:00
Shu Chen 5c08fb8e3b [diags] support platform specific diags in radio-only ncp (#3024) 2018-09-12 05:42:19 -10:00
Abtin Keshavarzian b510468c6e [toranj] disable OT logs in test-023 and test-015 (#3065) 2018-09-11 23:27:33 -10:00
Abtin Keshavarzian 6fb1e9f05f [dataset] do not use Channel Mask TLV as MAC's supported channel mask (#3058)
This commit changes the code to treat Channel Mask TLV from
Operational Dataset and the MAC layer supported channel mask as
two different (unrelated) network parameters. In particular:
- With this commit, the Channel Mask TLV value is ignored when
  applying a Dataset from `Dataset:ApplyConfiguration()`.
- However, when we create an Active Operational Dataset as leader in
  `ActiveDataset::GenerateLocal()` method, the MAC layer's supported
  channel mask is still used for the Dataset Channel Mask TLV value.
- This commit also adds a check in `Mle::SendAnnounce()` to ensure
  that MLE Announcements are not sent on channels that are are not
  included in the MAC layer's supported channel mask.
2018-09-11 21:58:07 -10:00
Yakun Xu c4f44ae0ca [udp] remove transport pointer (#3064) 2018-09-11 14:56:59 -10:00
Yakun Xu 8a093a3f83 [meshcop] stop coaps before restart (#3063) 2018-09-11 14:53:16 -10:00
Jiacheng Guo e53c8824ac [cc2538] fix wrong uart rx ioc config (#3062) 2018-09-11 14:52:01 -10:00
rongli 952542ae35 [mle] fix connectivity parse if default sed capacity is not included (#3061) 2018-09-11 14:49:47 -10:00
Abtin Keshavarzian cd6b9e835c [posix-app] clear and free mTxRadioTid from Receive (#3046) 2018-09-11 14:47:07 -10:00
Yakun Xu 311b9283c2 [tests] move test_diag into tests/scripts/thread-cert (#3049) 2018-09-11 01:22:42 -10:00
Abtin Keshavarzian 8c5775cbfc [mle] log Thread Mode change (#3059)
This commit adds a log line (at log level `OT_LOG_LEVEL_NOTE`) to
indicate the mode change and the new mode value.
2018-09-10 19:36:36 -10:00
Yakun Xu d9da4c2652 [udp] verify destination before binding (#3055) 2018-09-10 18:11:06 -10:00
Yakun Xu 26fab7399d [posix-app] get real rssi from NCP (#3051) 2018-09-10 18:03:42 -10:00
Yakun Xu 50d0de5792 [toranj] fix typo of toranj tests (#3050) 2018-09-10 18:00:34 -10:00
Yakun Xu 1cbfc66edf [tests] enable self tests (#3048) 2018-09-10 14:46:05 -10:00
Abtin Keshavarzian b7c0c8ed99 [posix-app] update timer implementation to handle speedup (#3045) 2018-09-10 14:42:20 -10:00
Abtin Keshavarzian 42e44e34f9 [radio] update definition of otRadioCaps and the related constants. (#3044) 2018-09-10 14:41:03 -10:00
Yakun Xu afb4d2e72a [travis] add code coverage flag (#3037) 2018-09-10 14:40:23 -10:00
Zhanglong Xia c573dafe8e [ncp] fix clearing unsecure ports (#3022) 2018-09-10 14:39:06 -10:00
Abtin Keshavarzian 0d0c04ece2 [posix-app] add $(OPENTHREAD_TARGET_DEFINES) to CPPFLAGS_COMMON in Makefiles. (#3041) 2018-09-07 07:21:04 -10:00
Abtin Keshavarzian 144a4e3e06 [mle] add MLE counters (#2982)
This commit adds support for a set of MLE counters (e.g., counters to
track number of times device entered different roles, or counters
tracking number of attach attempts, partition ID or parent changes).
2018-09-06 21:01:31 -10:00
Yakun Xu abfb16eb7f [posix-app] tmf proxy to udp proxy (#3039) 2018-09-06 20:58:21 -10:00
Shu Chen b795c729d3 [posix-app] support platform energy scan in posix-app (#3038) 2018-09-06 20:57:38 -10:00
Abtin Keshavarzian 045aa4f358 [travis] update "posix" and "posix-ncp-spi" targets to use new configure options (#3031) 2018-09-06 20:55:47 -10:00
Shu Chen 9a9da5124f [cli] support energy scan command (#3036) 2018-09-06 07:30:55 -10:00
Zhanglong Xia b83fa59914 [mesh-forwarder] add function to decompress IPv6 Header (#3014) 2018-09-06 07:28:08 -10:00
Abtin Keshavarzian 5d993e9868 [configure] add OpenThread example to output of configure script (#3028) 2018-09-06 07:18:23 -10:00
Abtin Keshavarzian accf58d965 [posix-app] include <util.h> on darwin target for forkpty (#3030) 2018-09-06 07:15:38 -10:00
Abtin Keshavarzian 4aefb910bc [posix-app] include <sys/prctl.h> only on Linux target (#3029) 2018-09-06 07:15:22 -10:00
Łukasz Duda 9119bd5e33 [nrf52840] suppress IAR error inside mbedtls (#3026) 2018-09-05 23:18:14 -10:00
Hubert Miś d05542dbf5 [nrf52840] use otSys prefix in the SoftDevice platform API (#3025) 2018-09-05 23:17:54 -10:00
Kamil Sroka 7917c7b1cc [nrf52840] enable ECDH in mbed TLS (#3023) 2018-09-05 23:17:23 -10:00
Yakun Xu b45cc3cd63 [posix-app] get radio caps from NCP (#3021) 2018-09-05 23:17:00 -10:00
Yakun Xu f227bbe7f2 [posix-app] fix alarm issue (#3035) 2018-09-05 23:16:33 -10:00
Shu Chen e34b0f3437 [posix-app] fix bug in posix-app initialization with real hardware (#3034) 2018-09-05 20:04:00 -10:00
Yakun Xu bdffbe5671 [posix-app] enhance virtual time for posix app (#3016) 2018-09-05 18:08:36 -07:00
Abtin Keshavarzian 2742886134 [posix-app] address integer conversions (#3018) 2018-09-05 00:44:27 -07:00
Abtin Keshavarzian 8c333e6e07 [posix-app] change GetReceiveSensitivity() return value to int8_t (#3017) 2018-09-05 00:43:26 -07:00
Shu Chen 3174c590c3 [utils] implement a common method for command line parsing (#3001) 2018-09-05 00:40:02 -07:00
Jonathan Hui a638442df8 [configure] separate example apps and ftd/mtd/radio in build config (#3010) 2018-09-05 00:35:52 -07:00
Jing 11014739f2 [thci] OpenThread wpanctl THCI bug fix (#3012) 2018-08-31 17:56:33 -07:00
rongli 9f9d76b8bc [ncp] fix no reply issue for ping to RLOC/ALOC (#3011) 2018-08-31 17:55:32 -07:00
Abtin Keshavarzian fdd770b8fc [mle] inline simple getter methods (#3007) 2018-08-31 08:57:54 -07:00
Yakun Xu 5016af4cde [tests] increase child timeout (#3000)
* fix calculate default poll period

* add default child timeout in config.py

* define FAILED_CHILD_TRANSMISSIONS
2018-08-30 11:58:32 -07:00
hjian2017 cb63295975 [coap] improve readability (#3008) 2018-08-30 10:18:13 -07:00
Hubert Miś 4665732e81 [nrf52840] fix millisecond alarm trigger condition (#3009) 2018-08-30 10:17:29 -07:00
Jonathan Hui 1aa0a9b5d8 [diags] fix build error introduced in 2d0baf8 (#3006) 2018-08-29 13:10:15 -07:00
Giedrius b5ce567ffd [api] add return code to otCoapHeaderSetPayloadMarker (#3004) 2018-08-29 09:59:02 -07:00
Hubert Miś c2f32e3df8 [nrf52840] update drivers to SDK 15.1.0 (#3003) 2018-08-29 09:58:29 -07:00
Shu Chen 2d0baf8fc5 [ncp] remove diags module from radio only ncp (#3002)
The diags module runs on host side, radio only ncp will only act as
transceiver and support platform specific diags features.
2018-08-29 09:57:46 -07:00
Jeff Bumgardner b133a194fb [docs] revise THCI README (#3005) 2018-08-28 20:50:20 -07:00
rongli 54bf9ef0e0 [dataset] fix issue in applying pending dataset when delaytimer expires (#2988) 2018-08-28 11:52:02 -07:00
Yakun Xu 2e89aa0ad3 [tests] add missing simulator parameter (#2999) 2018-08-28 09:28:14 -07:00
rongli d103797ba0 [tests] fix unstable Cert_5_3_03 (#2998) 2018-08-28 09:26:45 -07:00
Jonathan Hui bf3c081843 [tests] update pycryptodome version to 3.6.6 (#2997) 2018-08-28 09:24:46 -07:00
Shu Chen 026badad96 [diags] use temporary buffer for diag output (#2992) 2018-08-28 09:24:23 -07:00
Abtin Keshavarzian 2f605e9953 [toranj] test covering multicast traffic over multi-hop (#2983)
This commit adds a test-case under `toranj` covering multicast
traffic exchange over a multi-hop network to the following multicast
IPv6 addresses: link-local/mesh-local all-nodes address, link-local
/mesh-local all-routers address, link-local/mesh-local all-thread-
nodes address, and user-specified multicast address.
2018-08-27 16:00:11 -07:00
Jing 48cbbfd32a [thci] add OpenThread Border Router support (#2947) 2018-08-27 10:51:03 -07:00
Shu Chen 315b7e4f9f [posix] make posix settings path configurable (#2993)
configure settings path on andriod to "/data/thread" as default, which will persist after reboot.
2018-08-27 10:44:30 -07:00
Jonathan Hui d54abf8c63 [travis] fix scan-build (#2990) 2018-08-27 09:41:32 -07:00
Kamil Sroka 693bf015f3 [nrf52840] add support for USB bootloader on PCA10059 (#2994) 2018-08-27 08:57:21 -07:00
Kamil Sroka 1b25bf1238 [nrf52840] add crypto to all platform lib variants (#2995) 2018-08-27 08:53:48 -07:00
rongli 5b7e49f21d [dataset] update active/pending dataset based on existing active dataset (#2991) 2018-08-24 19:14:06 -07:00
Hubert Miś dd3916c404 [nrf52840] fix TimeToTicks function in the alarm port (#2986) 2018-08-24 08:44:30 -07:00
Abtin Keshavarzian 20ccd55c16 [makefile] add missing files to libopenthread-radio source list (#2989) 2018-08-23 11:16:15 -07:00
Jonathan Hui eba708f018 [mbedtls] simplify source file listing in Makefile.am (#2984) 2018-08-23 10:34:10 -07:00
Abtin Keshavarzian d1a0b80a53 [toranj] multicast IPv6 addresses on routers/FED/SED (#2979)
The new test covers the following:
- Verify all nodes (routers/FED/SED) subscribe to:
   * Link-local all nodes, realm-local all nodes,
   * Link-local all Thread nodes, realm-local all Thread nodes,
   * All MPL forwarder realm-local.
- Verify routers also subscribe to:
   * Link-local all routers, realm-local all nodes.
- Verify adding/removing multicast addresses on all devices.
2018-08-23 10:27:51 -07:00
jciupis 36e238453f [nrf52840] add missing radio driver source file to appropriate Makefile (#2987) 2018-08-22 16:11:11 -07:00
Abtin Keshavarzian 024cf82ab0 [toranj] add test-case for address cache table (#2972)
This test verifies the behavior of `AddressResolver` module and
entries in address cache table. It also tests the behavior of nodes
when there are topology changes in the network (e.g., a child switches
parent). In particular, the test covers the address cache update
through snooping.
2018-08-22 13:30:54 -07:00
Abtin Keshavarzian abecb07ba1 [tools] add bash script git-squash-merge (#2962)
This commit adds a new script `git-squash-merg` which can help with
performing squash merge of a branch into another. The commit message
includes the list of squashed commits. This script is helpful for
synchronization of git repositories that work with gerrit.
2018-08-22 13:30:14 -07:00
Abtin Keshavarzian 6ab5c63435 [toranj] update form/join tests to cover new wpanctl capabilities (#2978)
This commit updates the `toranj` tests related to forming/joining
a network to cover newly added capabilities to wpanctl `form`/`join`
commands (allowing all parameters to be given as part of the
command itself).
2018-08-21 09:41:45 -07:00
Abtin Keshavarzian cae716acc3 [toranj] update test-001 to get and set more wpan properties (#2976) 2018-08-21 09:40:03 -07:00
Yakun Xu af2bfc1cc4 [test] save packets as pcap file in thread-cert tests (#2965) 2018-08-20 09:27:04 -07:00
Abtin Keshavarzian e731babedb [mle] simplify device role checks using IsAttached method (#2975) 2018-08-18 18:04:33 -07:00
Abtin Keshavarzian f993ba5f89 [toranj] add test-case for router table (#2970)
This commit adds a test-case under `toranj` to verify router table
entries on a network with 4 routers: {r1, r2, r3} forming a loop
with r4 connecting to r3.
2018-08-17 14:36:05 -07:00
Yakun Xu 0cea4bc738 [cli] return number of bytes in ping reply (#2973) 2018-08-17 11:53:54 -07:00
Yakun Xu e7de6eafa3 [test] enhance android build check (#2974) 2018-08-17 11:49:35 -07:00
Seth Rickard ef31de69c1 [cc13x2_cc26x2] fix runtime issue with RF patching (#2971) 2018-08-17 09:34:13 -07:00
Hubert Miś 8d2184a4e7 [nrf52840] update nRF52840 radio driver to version 1.2.0 (#2968) 2018-08-17 09:03:55 -07:00
Jonathan Hui c116441212 [api] change type from uint8_t * to otMeshLocalPrefix (#2966) 2018-08-17 08:59:37 -07:00
Abtin Keshavarzian 37b5a9655c [toranj] Child Supervision test (#2951)
This commit adds a new test-case under `toranj` for Child Supervision
feature.

This test uses MAC whitelisting to emulate the situation where a child
is removed from parent's child table while the child continues to stay
attached to the parent (since data polls from child are acked at radio
platform layer). Specifically the test verifies that once supervision
check is enabled on the child, the child detects that it is no longer
in the parent's table and tries to re-attach. The test verifies the
behavior of both the parent and the child when supervision is enabled.
It verifies that the parent is periodically sending supervision
messages to the child and that the child is monitoring the messages
from parent. This test also indirectly verify the child timeout
behavior on a parent.
2018-08-15 15:47:50 -07:00
Abtin Keshavarzian 3ff432f152 [spi-hdlc-adapter] update README.md (fix typos) (#2961) 2018-08-15 12:48:31 -07:00
Abtin Keshavarzian ce48bf1819 [toranj] test behavior of "inform previous parent" feature (#2964)
This commit adds a new test-case under `toranj` frame-work to verify
the behavior of devices under the "inform previous parent" feature.

With this feature enabled, when a child attaches to a new parent, it
will send an IP message (with empty payload) to its previous parent.
Upon receiving this message the previous parent would immediately
remove the child from its child table.

The test network topology consists of two routers/parents and a single
sleepy child. The child is first attached a parent and is then forced
to switch its parent. It's then verified that the child is removed
from first parent's child table.
2018-08-15 10:27:52 -07:00
Jonathan Hui 920197398b [api] change type from uint8_t* to otExtendedPanId (#2960) 2018-08-15 10:12:49 -07:00
Abtin Keshavarzian ae5421ecbd [toranj] reduce number of routers/children in test-016-neighbor-table (#2963) 2018-08-15 10:12:00 -07:00
Yakun Xu 0c07c53ce3 [platform] attach timestamp in promiscuous mode (#2954) 2018-08-10 09:26:11 -07:00
Yakun Xu d2e59fd645 [posix-app] fix getting tx power (#2957) 2018-08-10 01:16:00 -07:00
Jonathan Hui c8d06c402e [efr32] fix em_system.h include (#2956) 2018-08-09 18:31:34 -07:00
Yakun Xu 101e243372 [nrf52840] fix default parameters of FEM (#2945) 2018-08-08 18:30:30 -07:00
Jonathan Hui 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
rongli 90ee0a4d66 [ncp] add joiner spinel support (#2877) 2018-08-08 11:18:53 -07:00
Yakun Xu e181f1f98e [posix-app] fix diag issues of radio only mode (#2948) 2018-08-07 19:15:14 -07:00
Jing 492f0c3b10 [harness-automation] update read method for TopologyConfig.txt format change (#2950) 2018-08-07 10:47:01 -05:00
Yakun Xu 8efb3c50e5 [meshcop] implement commissioning UDP proxy (#2926) 2018-08-06 14:50:41 -05:00
Abtin Keshavarzian a9d32b7bef [ncp] add support for Commissioner APIs in spinel and NCP (#2911)
This commit adds support for Commissioner related APIs in spinel and
NCP including starting/stopping Commissioner, setting Provisioning
URL, adding/removing Joiners, and sending Announce Begin, Energy Scan
Query, PAN ID Query, MGMT_GET/MGMT_SET messages.
2018-08-06 14:46:01 -05:00
Jonathan Hui f089fc8e25 [gcc8] resolve compiler errors (#2944)
This commit resolves compiler errors generated by gcc8.

This commit also adds gcc8 build checks to travis.
2018-08-03 14:14:41 -05:00
Jonathan Hui f0bb0982ee [examples] change example platform namespacing (#2927) 2018-08-03 14:13:47 -05:00
Abtin Keshavarzian 1ca81fbb16 [ncp] add support for child supervision in spinel/NcpBase (#2939) 2018-08-02 17:21:11 -05:00
Abtin Keshavarzian c551e30350 [posix] handle signals SIGHUP or SIGTERM and exit (#2930)
This commit adds signal handler in posix example platform for
signals SIGHUP and SIGTERM. Upon receiving either signal the
process is terminated using `exit(0)`.
2018-08-02 17:17:40 -05:00
Abtin Keshavarzian 44e583a554 [toranj] add new method to finalize all nodes at end of each test (#2930)
This commit adds a new method `finalize_all_node()` in `wpan.Node`
class to finalize all previously created instances of `wpan.Node`. It
terminates the associated `wpantund` process and wait.
2018-08-02 17:17:40 -05:00
Abtin Keshavarzian d67c4e2f6b [ncp] include prop set support for THREAD_CHILD_TIMEOUT in MTD build (#2943) 2018-08-02 00:55:35 -05:00
Yakun Xu 601b99b394 [android] use spi instead of uart (#2942) 2018-08-02 00:54:48 -05:00
Jonathan Hui ba4b238a00 [link-quality] explicitly clear link quality for new child/router (#2941)
The child/router entries are generally cleared using `memset()` to avoid
explicitly setting all fields to zero.  As a result, it is necessary to
explicitly clear the link quality state to properly initialize the last
RSSI reading.  The user-specific constructors are also removed.
2018-08-01 10:33:03 -05:00
Jonathan Hui 412f9740b0 [tlv] remove unnecessary user-specified constructor (#2940) 2018-08-01 10:32:46 -05:00
Jonathan Hui bcfa7edff1 [ip6] ensure slaac addresses are added back after reset (#2938)
This commit makes the following changes:

1. A child that is resynchronizing with its parent after reset always
   requests the network data to ensure that it has the latest version.

2. When autoconfiguring SLAAC addresses in response to a network data update
   always attempt to add the netif address buffer in case the netif
   structure was removed (e.g. due to reset).
2018-08-01 10:32:27 -05:00
Jonathan Hui 7be61df6ec [message-info] remove unnecessary memset initialization (#2937) 2018-07-31 14:10:02 -05:00
Jonathan Hui c097cd2d3b [mle] remove unused LeaderDataTlv from HandleChildUpdateRequest (#2936) 2018-07-31 14:09:48 -05:00
Abtin Keshavarzian a9932027fa [toranj] test case for adding IPv6 addresses with same prefix on multiple nodes (#2915)
This commit adds a new test script for `toranj` test frame-work
covering the situation when IPv6 addresses with same prefix are
added/removed on multiple nodes. The test verifies that the on-mesh
prefix list on all nodes stays consistent and updated as the addresses
are added/removed and nodes are reset.
2018-07-31 12:38:40 -05:00
Abtin Keshavarzian 2aa335144c [mle] fix logging at NOTE level (#2933)
This commit fixes the issue when building at `LOG_LEVEL_NOTE`
ensuring methods such as `AttachModeToString` are included.
2018-07-31 11:18:12 -05:00
Abtin Keshavarzian 3acd900bdf [message] update comment/documentation (#2903) 2018-07-31 10:41:26 -05:00
Abtin Keshavarzian 68535657df [toranj] test case to verify child restoration after parent reset (#2935)
This commit adds a new test-case under `toranj`. The test covers
the following situation:

- A single parent node with three sleepy and two rx-on children.
- Parent node is reset.
- It is verified that all children are recovered and are present
  in the parent's child table after reset.
- It is also verified that all children are restored on parent
  through "Child Update" exchange process and none of them get
  detached.
2018-07-30 16:04:58 -05:00
Abtin Keshavarzian 1c7f811b32 [mle] fix issue with saving child info to non-volatile (#2935)
This commit addresses an bug where the child info was not being
saved in non-volatile settings. It fixes the following cases in
the code where a child id was used to search for a child (using
`FindChild()`) instead of the RLOC16 address:

- `StoreChild()` is changed to accept a `const Child &` as input
  parameter avoiding the need to look up the child by ID or RLOC16.
- `SendChildIdResponse()` and `GetChildInfoById()` are updated to
  perform the search for a child using its RLOC16.
2018-07-30 16:04:58 -05:00
Jonathan Hui ffff5f3f6f [travis] remove lib32z1 from arm-gcc-6/7 build checks (#2928) 2018-07-30 10:46:28 -05:00
Jonathan Hui d24b02ea79 [github] update issue templates (#2920) 2018-07-30 10:46:10 -05:00
Jonathan Hui d3b5b8fa60 [flash] move example flash driver from c++ to c (#2919) 2018-07-30 10:45:50 -05:00
Jonathan Hui b6c2a2b06e [kw41z] load bytes into TX Packet Buffer in order (#2882)
The MKW41Z Reference Manual Section 44.6.2.7 states:
- "The 802.15.4 Link Layer software prepares data to be transmitted, by
  loading the octets, in order, into the Packet Buffer."

This commit maintains a separate buffer for building the transmit frame
then copies the buffer just before the transmit frame is submitted to the
radio.
2018-07-30 10:45:24 -05:00
Jonathan Hui f824343f8c [config] add check for OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT (#2925) 2018-07-26 02:17:29 -05:00
Abtin Keshavarzian 7978810afe [config] update comment/docs for MAX_TX_ATTEMPTS_INDIRECT_POLLS (#2924) 2018-07-26 02:17:16 -05:00
Tomas Cerskus 2b8e2362b7 [efr32] do not use CCA/CSMA when it is disabled (#2923) 2018-07-26 02:16:44 -05:00
Jonathan Hui f5aa83cad7 [mac] fix build failure with CONFIG_DISABLE_CSMA_CA_ON_LAST_ATTEMPT (#2922) 2018-07-26 02:15:47 -05:00
Kamil Burzynski c7e62553e5 [mle] support for long routes (#2775)
This commit introduces changes necessary to support long routes (i.e. route
cost >= 16).

This is an experimental feature that requires changes to the route
information communicated in MLE messages.  As a result, it is not compatible
with the Thread 1.1 specification.

This feature is disabled by default.
2018-07-26 02:14:49 -05:00
Abtin Keshavarzian bb064cd074 [toranj] add test-case for "Thread:NeighborTable" (#2917) 2018-07-25 04:26:16 -05:00
Abtin Keshavarzian 3796b33e6a [commissioner] add new API to get Provisioning URL (#2884) 2018-07-25 04:20:41 -05:00
Jonathan Hui 14a1f49011 [efr32] update to Gecko SDK v2.3 (#2909) 2018-07-24 03:59:33 -05:00
Yakun Xu f22cddb9ee [core] move border agent into thread_netif (#2893) 2018-07-23 09:14:23 -05:00
Abtin Keshavarzian 9d7a9f1e21 [core-config-check] add CONFIG_MAX_TX_ATTEMPTS_DIRECT to list of replaced options (#2910) 2018-07-23 09:10:32 -05:00
Yakun Xu e220197b6b [meshcop] allow MBEDTLS_ERR_SSL_WANT_WRITE from mbedtls_ssl_write() (#2906)
* increase message buffers to pass meshcop check
2018-07-23 09:08:51 -05:00
rongli dcc3eac579 [network-data] clean stale child's server info when its parent is removed (#2905) 2018-07-23 09:06:38 -05:00
Abtin Keshavarzian 6269da241b [mle] fix retransmission of Data Request messages (#2895)
This commit renames the timer used for Child Update transmissions  to
`mMessageTransmissionTimer` and allow it to be used for retx of MLE
Data Request messages when there is no pending or active MLE Child
Update Request. It also adds logic to ensure that the device gets
detached after some number of MLE Data Request attempts with no
response.
2018-07-23 09:03:49 -05:00
Abtin Keshavarzian ffc2b972ab [toranj] perform a subprocess.poll() on wpantund instance during init of nodes (#2901)
This allows the underlying wpantund process associated with a `Node`
instance to be executed while we are waiting for it to be initialized.
It also protects against any unexpected termination of an instance.
This change would help with speed of initialization of all nodes
mainly when there are many instances running in parallel.
2018-07-20 14:41:24 -05:00
Abtin Keshavarzian 8e28b626a9 [spinel] add a section for MeshCop properties and update documentation (#2885)
This commit updates the documentation of spinel property sections
and also adds a new range 0x080 - 0x08F, 0x1800 - 0x18FF allocated
for MeshCop related properties.
2018-07-20 13:50:09 -05:00
Yakun Xu d50e3713c3 [meshcop] fix handling commissioner keep alive (#2907) 2018-07-20 10:47:35 -05:00
Jeff Bumgardner 7586509525 [docs] update API menu for new APIs (#2902) 2018-07-19 23:53:24 -05:00
Abtin Keshavarzian 3ee31ec562 [commissioner] update comments and method documentations (#2900) 2018-07-19 23:43:08 -05:00
Jonathan Hui 1075e35327 [code-style] remove multiple return statements per free function or method (#2891)
There should be one return statement per free function or method at the end
of the free function or method.
2018-07-19 20:09:07 -05:00
Robert Lubos 9b211b76c6 [nrf52840] prevent linker from dicarding strong nrf5CryptoInit implementation (#2899)
Linker will discard libmbedcrypto_a-cc310_mbedtls.o when searching
mbedTLS library, if it finds weak implementation of
nrf5CryptoInit/Deinit before strong ones. Adding additional
symbols to this file will prevent this behavior and make linker
to search libmbedcrypto_a-cc310_mbedtls.o even after weak
implementations are found.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-19 16:49:30 -05:00
Shu Chen c863a35662 [nrf52840] don't reinitialize cc310 during pseudo reset (#2897)
The device hangs when reinitialize cc310.
2018-07-19 16:47:50 -05:00
Abtin Keshavarzian 758e647d91 [dataset] update dataset SendMgmtGet APIs and add support in spinel/NCP (#2866)
This commit updates the APIs `otDatasetSendMgmtActiveGet` and
`otDatasetSendMgmtPendingGet` to be similar to MgmtSet APIs and use an
`otOperationalDatasetComponents` as input to specify the Dataset
components to be requested. The implementation of APIs in
`DatasetManager` and their use in in CLI is also updated.

It also defines new spinel properties `MGMT_GET_ACTIVE_DATASET` and
`THREAD_MGMT_GET_PENDING_DATASET` (with their set handlers) to add
support for sending `MGMT_GET` meshcop command for Active/Pending
Operational Dataset. It also renames the existing properties used for
sending `MGMT_SET` (include `MGMT_SET` in the property name).

It also adds a new property to allow an optional destination IPv6
address to be specified (for sending `MGMT_GET` command) as part of
spinel dictionary representation of Dataset instance.
2018-07-19 16:33:49 -05:00
Jonathan Hui 7ba8f348dc [mac] separate configs for macMaxCSMABackoffs and macMaxFrameRetries (#2881)
This commit aligns the MAC CSMA backoff and retransmit configuration more
closely with IEEE 802.15.4-2006.
2018-07-19 16:32:45 -05:00
Yakun Xu 0645a3ae65 [travis] fix cert 5-2-05 address query (#2894) 2018-07-16 11:28:21 -05:00
Yakun Xu 564d57ec07 [travis] fix Cert_6_3_02_NetworkDataUpdate of posix-ncp check (#2892) 2018-07-16 11:26:12 -05:00
Kamil Sroka 3cd6fad5aa [travis] update UDP_PROXY flag (#2890) 2018-07-13 14:10:12 -05:00
Yakun Xu f2268fadbc [core] inline instance getters (#2889) 2018-07-13 12:23:41 -05:00
Kamil Sroka d7f8a5b631 [ncp] remove unused variable from ncp_base_mtd.cpp (#2887) 2018-07-13 11:35:47 -05:00
Abtin Keshavarzian d68ac05bae [toranj] update wpan.init_all_nodes to allow wait time per node (#2886)
This commit also moves the disabling of the log within the `try`
region to ensure it is retried in case wpantund instance is not
yet ready.
2018-07-13 11:34:50 -05:00
Shu Chen ae58f6cc06 [build] separate Header IE feature from time sync code (#2876)
Add a configure option to enable/disable Header IE support: OPENTHREAD_CONFIG_HEADER_IE_SUPPORT

So then the Header IE generation and parsing feature could be enabled separately.
2018-07-13 11:33:22 -05:00
Yakun Xu ae4e5171ef [posix-app] fix bugs of posix apps (#2888)
1. avoid possibility of reentrant to Hdlc::Decode
2. do not send unwanted ACK to core stack
2018-07-13 10:50:14 -05:00
rongli 51a1a5f12b [core] update Child Update Request aggregation feature (#2874) 2018-07-12 23:51:00 -05:00
Abtin Keshavarzian 0d0c4ceaea [ncp] increase ChangedPropsSet max supported entries to 64 (#2883)
This commit increases the maximim number of entries that can be
supported by `Ncp::ChangePropsSet` to 64 by using `uint64_t` to
save the flags instead of `uint32_t`.
2018-07-12 21:49:00 -05:00
Abtin Keshavarzian eee83a0d38 [toranj] disable OT/NCP logs (by default) during initialization of nodes (#2880)
This commit changes `wpan.init_all_nodes()` to disable OT/logs on
all nodes as the default behavior.
2018-07-12 10:49:20 -05:00
Abtin Keshavarzian f065438111 [ncp] add UDP_PROXY_STREAM to dispatcher list and update documents (#2879) 2018-07-11 20:16:56 -05:00
Zhanglong Xia b5dd84222f [mac] enable broadcast message retransmission in MAC layer (#2815) 2018-07-11 16:03:19 -05:00
Shu Chen c0454408a8 [nrf52840] reinitialize all peripherals except uart for pseudo reset (#2878)
There are some problems if radio is not reinitialized during pseudo reset:
* It may trigger unexpected otPlatRadioTxDone(), and cause the device to hang;
* The uncleared radio timer queue is invalid, it may block the new added timer which has a larger targer time.

Note: The clock init/deinit is disabled during radio init/deinit.
2018-07-11 14:21:48 -05:00
Stuart Longland 36ea84e06b [cc2538] avoid possible deadlock in otPlatRadioTransmit (#2371)
* [cc2538] Add definitions for FSMSTAT0 and RFERRF bits.

This adds a register definition for `RFCORE_XREG_FSMSTAT0` and defines
the bits in `RFCORE_SFR_RFERRF`.

* [cc2538] Check for error conditions on transmit.

The transmit code first waits for an existing transmission to finish,
then sets things up for the next transmission and waits for the radio to
go into receive mode before proceeding.

If, the radio receive buffer overflows during this time, the radio will
enter a RX overflow state (state 0x11 in `FSMSTAT0`) and will block
there until the RX FIFO is flushed.

In such cases, the CC2538 hard-locks due to the while loop waiting for
the `RX_ACTIVE` bit to be set.  While waiting for `RX_ACTIVE`, we need
to check for these overflow conditions, handle them, then re-try our
transmitter set-up.

* [cc2538] Re-try transmit set-up on IDLE

If we enter the idle state, then rather than just setting the channel,
re-try our transmitter set-up since we should be in the correct state
to do this at this point.
2018-07-11 14:10:52 -05:00
Kamil Sroka 9cb7c4b634 [travis] add link raw to nrf52840 build checks (#2875) 2018-07-10 16:22:53 -05:00
Jonathan Hui a05fcb6e1d [travis] add cc1352 build checks (#2873) 2018-07-10 15:56:23 -05:00
Jonathan Hui af0e3f19fa [tlv] change GetSize() return type to uint16_t to avoid overflow (#2870)
Credit to OSS-Fuzz.
2018-07-10 14:13:16 -05:00
Abtin Keshavarzian 8c8a953d29 [toranj] adding verify_within and updating test-014-ip-address-add. (#2871)
This commit adds a new function `verify_within` in `toranj` wpan
library. This function verifies that certain conditions (given as
function handler) pass within a given wait time interval. The
`verify` function is also changed to raise an exception (instead
of immediate `exit(1)`).

The new function is then used in `test-014` to allow faster checks
after device reset while giving longer wait time for test to pass.
2018-07-10 12:13:11 -05:00
Jonathan Hui b8181ce76d [android] fix removal of tmf_proxy.cpp in Android.mk (#2872) 2018-07-09 22:15:19 -05:00
Seth Rickard 5fc1788d37 [cc1352] add support for Texas Instruments CC1352 (#2863) 2018-07-09 15:28:41 -05:00
Yakun Xu 96a7e2d5a5 [meshcop] move border agent into core (#2771)
This commit moves the border agent service into OpenThread core.

Border agent, commissioner, and joiner shares a single secure CoAP agent,
because they will not be active at the same time.

Other changes include:
- Replaced TMF proxy with UDP proxy, which is more generalized.
- Changed OT_ERROR_NONE string to "OK".
- Defined a special interface id -1 to differentiate packets received by
  host side.
2018-07-09 15:25:23 -05:00
Kamil Sroka 8555513247 [build] fix errors and warnings when building on IAR and Keil (#2868) 2018-07-09 11:17:46 -05:00
Yakun Xu 93bb67024f [posix-app] add Makefile for building with android build system (#2864) 2018-07-09 11:15:43 -05:00
Shu Chen cdc772759e [nrf52840] avoid unexpected transmit done callback after pseudo reset (#2862)
Introduce a nrf5RadioPseudoReset() method, it will put the radio to sleep mode,
and clear the pending events during pseudo reset. So to avoid unexpected transmit
done callback after pseudo reset, which may cause the device to hang.
2018-07-09 11:05:45 -05:00
rongli 19c73f8b66 [core] update tmf rules to allow link local multicast address as dest (#2865) 2018-07-06 23:43:32 -05:00
Yakun Xu d54076ea97 [api] fix reset for radio only mode (#2859) 2018-07-04 22:46:26 -05:00
Yakun Xu 42e590a8fc [posix-app] add missing check for spinel radio (#2855) 2018-07-04 22:45:53 -05:00
Abtin Keshavarzian 52354e73c7 [ncp] add new fields (age, rssi, etc) to PARENT spinel property (#2854)
This commit appends new fields to format of `PROP_THREAD_PARENT`
spinel property. The new fields provide age, avrerage RSSI and
last RSSI, etc. This commit also updates the spinel documentation.
2018-07-04 15:40:40 -05:00
Abtin Keshavarzian 4e6e1bc568 [toranj] test-case for adding IPv6 addresses (#2853)
This commit adds a `toranj` test for adding/removing IPv6 addresses
on routers, FEDs, and SEDs (on network interface).

The test then covers the following:
- Verify "IPv6:AllAddresses" wpantund property.
- Verify that prefixes are present in network data corresponding
  to added addresses (on all nodes).
- Verify that a SED does register the address with its parents
  ("Thread:ChildTable:Addresses" wpantund property).
- Verify that addresses/prefixes are retained by wpantund over
  NPC resets.
- Verify that when an address is removed on network interface
  its corresponding prefix is also removed (on all nodes).
2018-07-04 00:14:55 -05:00
Abtin Keshavarzian da9d0df373 [toranj] add support for add-prefix and remove-prefix (#2852)
This commit updates `wpan.py` module to include newly added wpanctl
commands `add-prefix` and `remove-prefix` and include new `stable`
parameter for `add-route`. It also updates `test-10` to test the
behavior of the new commands.
2018-07-04 00:11:30 -05:00
Abtin Keshavarzian 751c92821a [mle-router] update the route table log message (#2839)
This commit changes the code such that the logs are emitted only if
the route table is updated. It also changes the log format.
2018-07-04 00:10:21 -05:00
Shu Chen 0c537d8c0e [nrf52840] set initialized state to false in nrf_drv_clock_uninit() (#2850)
Fix an issue that application could not reinitialize the clock again after nrf_drv_clock_uninit().
2018-07-04 00:05:48 -05:00
Abtin Keshavarzian 92282bffa7 [ip6] fix forwarding of off-mesh traffic on FED (#2847)
This commit addresses an issue with forwarding of off-mesh traffic
on FED. It also adds a `toranj` test-case to test adding of off-mesh
routes (on routers and FEDs) and traffic flow to off-mesh addresses.
2018-07-02 20:53:54 -05:00
Shu Chen 4aee236c6b [nrf52840] avoid endless "otPlatUartSendDone" log when using usb-cdc (#2849) 2018-07-02 13:08:02 -05:00
Abtin Keshavarzian d79bf6f268 [toranj] limit the logs during init of all nodes (#2848) 2018-07-02 10:48:17 -05:00
Jonathan Hui 6bd04ddcda [mesh-forwarder] retransmit on CCA errors (#2846)
This commit changes the way the mesh forwarder layer handles transmit
attempt failures due to CCA failures.  Prior to this commit, the mesh
forwarder layer would simply drop the packet.  This commit keeps the
packet in the queue so that it can be retransmitted at a later time.  This
applies to both direct and indirect transmissions.
2018-07-02 10:44:50 -05:00
Jonathan Hui 10666f5c1e [mac] ensure frame validation checks occur before reading FCF (#2845)
Credit to OSS-Fuzz.
2018-07-02 10:44:28 -05:00
Jonathan Hui 30222e8538 [radio] rename CcaEnabled to CsmaCaEnabled (#2844) 2018-07-02 10:44:09 -05:00
Abtin Keshavarzian 31698ecaf7 [mac] tracking supported channel mask (#2838)
This commit contains the following changes:
- Adds new logic to `Mac` to track supported channel mask along
  get/set methods.
- Adds public OT APIs `otLinkGetSupportedChannelMask()` and
 `otLinkSetSupportedChannelMask()` to get/set the channel mask.
- Ensures supported channel mask from `Mac` is included in Dataset
  TLVs when a local Dataset is generated.
- Ensures the channel mask at `Mac` gets updated when a new Dataset
  configuration is applied.
- Adds `OT_CHANGED` notification for signaling channel mask changes.
- Updates `NcpBase` and `PHY_CHAN_SUPPORTED` spinel property get/set
  handlers to adopt the new public APIs.
- Updates `NcpBase` to emit async `PHY_CHAN_SUPPORTED` updated on
  OT_CHANGED channel mask notification.
2018-07-02 10:43:45 -05:00
Abtin Keshavarzian fdb3d0ef58 [mesh-forwarder] update LogMessage to use NOTE level for failure/error cases (#2836)
This commit also contains
- Adding `Instance::GetLogLevel()` to get current log level on
  device.
- Adding new `otLogMac()` macro to log at MAC region with a run-time
  given log level.
2018-06-29 13:00:53 -05:00
Abtin Keshavarzian 38e7b30ef7 [ncp] update/add comments and re-order handler lookup (#2841) 2018-06-29 12:34:04 -05:00
Abtin Keshavarzian 60fc0ac05f [logging] change some log messages from INFO level to NOTE level (#2835)
This commit changes some of the log messages in `mle`, `ip6`,
`address_resolver` and `router_table` from INFO level to NOTE level.

It also adds missing `otLogNote<>` implementation for windows.
2018-06-28 16:20:24 -05:00
Kamil Sroka c925b42941 [link-raw] split software retransmit to retransmit and backoff (#2840) 2018-06-28 09:56:28 -07:00
Yakun Xu 8ccf1386de [ncp] adjust defining NCP handlers (#2829) 2018-06-28 11:26:31 -05:00
Abtin Keshavarzian e25570fb93 [settings] do not log setting delete operation with NOT_FOUND error (#2834) 2018-06-28 11:26:08 -05:00
Shu Chen f5d895c812 [posix] fix a bug when updating time info for time synchronization (#2837) 2018-06-27 11:41:44 -05:00
Jonathan Hui c325ab8a39 [ncp] add dhcp6 client support (#2833) 2018-06-26 22:26:36 -05:00
Shu Chen e69019f962 [time-sync] network-wide time synchronization service (#2618)
OpenThread network-wide time synchronization service is an experimental feature, not part of the standard Thread protocol.

Feature Overview:
 * All the nodes in the same Thread partition sync to the same Thread network-wide time;
 * Microsecond level time synchronization precision;
 * Flexible time accuracy and time sync period configuration;
 * APIs for application layer use case, support both CLI and NCP version.

The feature is wrapped by OPENTHREAD_CONFIG_ENABLE_TIME_SYNC, there's no change to current Thread 1.1
implementation if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is not enabled.

If OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is enabled, the node could:
 * Attach to a time sync enabled network, otherwise
 * Attach to a standard Thread 1.1 network, otherwise
 * Form a new time sync enabled network

In addition, if OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED is also enable, the node could only:
 * Attach to a time sync enabled network, otherwise
 * Form a new time sync enabled network

Note:
Currently, the feature is only supported on nRF52840 and posix platforms. And the network time
is only synced among Routers and REEDs, the SEDs will be supported later as an optional feature.
2018-06-26 13:46:32 -05:00
Jeff Bumgardner 292349c4d3 [docs] add missing Doxygen comments for radio (#2832) 2018-06-26 11:21:45 -05:00
Jonathan Hui e22f391af2 [da15000] resolve compiler warnings (#2831) 2018-06-26 11:20:10 -05:00
Tomas Cerskus 6b80574d10 [efr32] fix building errors on boards without FEM (#2830) 2018-06-26 11:19:04 -05:00
Yakun Xu 1b14a36a35 [posix] radio only host side driver (#2690) 2018-06-25 16:32:32 -07:00
Abtin Keshavarzian 17eace65e2 [child-table] fix typo in constant name (#2826) 2018-06-25 12:03:12 -07:00
Abtin Keshavarzian 2d973955a9 [child/router-table] overload ++ operator to advance iterators (#2828) 2018-06-25 07:04:55 -07:00
Abtin Keshavarzian d99a2cea8f [mesh-forwarder] limit mesh header message logging to FTD build (#2827)
This commit moves the methods related to logging mesh header
messages in `mesh_forwarder_ftd.cpp` and limit their scope to FTD
build. This helps reduce the code size of MTD build with logs
enabled.
2018-06-25 07:01:45 -07:00
Abtin Keshavarzian 8cc6848d67 [mac] simplify Mac::SetNetworkName(string) (#2825) 2018-06-25 06:44:04 -07:00
Abtin Keshavarzian 8f15ef3fbb [mle] reset the attach counter and restart backoff on "mode" change (#2824)
This changes addresses the situation where we have a single device
in network configured as sleepy end-device going through attach
backoff intervals and then user changes the device mode to be
non-sleepy and FTD. This change ensures that device become leader
quickly.
2018-06-25 06:43:36 -07:00
Abtin Keshavarzian 9ce38e0161 [notifier] always signal changed state/config for the first time (#2818)
This commit adds new logic in `Notifier` class (and how it is used) to
ensure when state/configuration is changed, each of the OT_CHANGED_*
events (e.g., channel, network name) is signaled for the first time
(even in case new set value is same as before).

This change addresses an issue where if user sets a parameter (using
OpenThread public APIs) before starting Thread operation the event
indicating the change would not be emitted.

This commit also defines `otChangedFlags` and `Notifier::Flags`
types, and updates the logging in `Notifier` to use `String` class.
2018-06-22 15:09:18 -07:00
Kamil Sroka d5797546e1 [link-raw] handle mIsCcaEnabled flag with software retransmit (#2821) 2018-06-22 09:23:50 -07:00
Kamil Sroka aa48f4d7b7 [nrf52840] fix building with link raw enabled (#2820) 2018-06-22 09:23:12 -07:00
Kamil Sroka a7b3ac780a [nrf52840] fix frames handling with disabled CCA (#2819) 2018-06-22 09:22:54 -07:00
Shu Chen 0616997957 [mac] separate aes ccm process from ProcessTransmitSecurity() method (#2810)
Create a new ProcessTransmitAesCcm() method, which is safe to be called in
interrupt context.
2018-06-21 08:45:19 -07:00
Jonathan Hui 4241b87800 [router-table] clear router table when changing partitions (#2809) 2018-06-21 08:44:09 -07:00
Yakun Xu b8333732fa [ncp] make NCP sources pretty (#2811) 2018-06-20 13:15:13 -07:00
Abtin Keshavarzian 9e2d7181ae [mesh-forwarder] add logs for forwarded MeshHeader messages (#2783)
This commit adds a new method `MeshForwarder::LogMeshMessage()` to log
info about messages with `MeshHeader` (messages that are forwarded by
device). The new logs indicate  when a message is received/sent or
possibly dropped. The immediate source and destination for the
received or sent frame is logged. The new logs include info from
`MeshHeader` such as mesh source, mesh destination, number of hops
left. If the message is fragmented, info from fragment header such as
datagram tag and offset is included in the logs. For a non-fragmented
or a  first fragment, `LogMeshMessage()` will also decompress the IPv6
and transport (UDP/TCP) headers and provide info from them such as
IPv6 source/destination addresses, UDP/TCP checksum, source/destination
port numbers.

In addition to the new logs, this commit add the following changes:
- Adds `\t` to log lines which are grouped (make it easier to read).
- Adds `const` qualifiers to some methods in `Lowpan::MeshHeader`.
- Adds new method in `FragmentHeader` to init it from a `Message`.
- Refactors/updates some methods in `Lowpan` class (e.g., adding new
  public method to decompress LOWPAN_NHC UDP header).
2018-06-19 12:22:29 -07:00
Kamil Burzynski 403723dc82 [mle] minor TLV and route table cleanup (#2807) 2018-06-19 09:59:13 -07:00
Yakun Xu b5f22dcb5d [posix] remove duplicated definition in Makefile-posix (#2808) 2018-06-19 08:41:14 -07:00
4346 changed files with 573118 additions and 900848 deletions
-65
View File
@@ -1,65 +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.
#
version: 0.1.{build}
image: Visual Studio 2015
configuration:
- Release
platform:
- x64
- x86
- arm
clone_depth: 10
install:
- cmd: Bcdedit.exe -set TESTSIGNING ON
# Configure logging
- cmd: reg import tools\windows\ThreadEtw.reg
- ps: Restart-Computer -Force
- ps: Start-Sleep -s 10
before_build:
- cmd: ren "C:\Program Files (x86)\Windows Kits\10\include\00wdf" "wdf"
build:
project: etc/visual-studio/openthread.sln
verbosity: minimal
after_build:
- ps: $env:Platform2 = $env:Platform
- ps: If ($env:Platform2 -eq "x86") { $env:Platform2 = "Win32" }
# Set up the release directories
- cmd: .appveyor\make_release.cmd
# Install driver (only runs on x64)
- cmd: .appveyor\install_driver.cmd
test_script:
# Run the unit tests
- cmd: .appveyor\run_unit_tests.cmd
# Run the tests for the driver (only runs on x64)
#- cmd: .appveyor\test_driver.cmd
artifacts:
- path: release
name: release
- path: build\bin\AppPackages
name: app
-43
View File
@@ -1,43 +0,0 @@
REM
REM Copyright (c) 2016, The OpenThread Authors.
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM 1. Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in the
REM documentation and/or other materials provided with the distribution.
REM 3. Neither the name of the copyright holder nor the
REM names of its contributors may be used to endorse or promote products
REM derived from this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
IF NOT "%Platform%"=="x64" GOTO :EOF
pushd %APPVEYOR_BUILD_FOLDER%\build\bin\%Platform2%\%Configuration%\sys
REM Install the certifications to the cert stores
certutil -addstore root otLwf.cer
certutil -addstore TrustedPublisher otLwf.cer
cd otLwf
REM Install the NDIS LWF driver, otLwf.sys
netcfg.exe -v -l otlwf.inf -c s -i otLwf
popd
-87
View File
@@ -1,87 +0,0 @@
REM
REM Copyright (c) 2016, The OpenThread Authors.
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM 1. Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in the
REM documentation and/or other materials provided with the distribution.
REM 3. Neither the name of the copyright holder nor the
REM names of its contributors may be used to endorse or promote products
REM derived from this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
pushd %APPVEYOR_BUILD_FOLDER%
REM Make the release directories
mkdir release
mkdir release\include
mkdir release\include\openthread\
mkdir release\include\openthread\missing
mkdir release\include\openthread\platform
mkdir release\libs
mkdir release\symbols
mkdir release\symbols\TraceFormat
REM Copy the relavant include headers
copy include\openthread\commissioner.h release\include\openthread
copy include\openthread\dataset.h release\include\openthread
copy include\openthread\instance.h release\include\openthread
copy include\openthread\ip6.h release\include\openthread
copy include\openthread\joiner.h release\include\openthread
copy include\openthread\link.h release\include\openthread
copy include\openthread\message.h release\include\openthread
copy include\openthread\netdata.h release\include\openthread
copy include\openthread\openthread.h release\include\openthread
copy include\openthread\thread.h release\include\openthread
copy include\openthread\types.h release\include\openthread
copy include\openthread\platform\toolchain.h release\include\openthread\platform
copy src\missing\stdbool\stdbool.h release\include\openthread\missing
copy src\missing\stdint\stdint.h release\include\openthread\missing
REM Copy the relavant binaries
copy build\bin\%Platform2%\%Configuration%\sys\otlwf\* release
copy build\bin\%Platform2%\%Configuration%\sys\otlwf.cer release
copy build\bin\%Platform2%\%Configuration%\sys\otlwf.pdb release\symbols
copy build\bin\%Platform2%\%Configuration%\sys\ottmp\* release
copy build\bin\%Platform2%\%Configuration%\sys\ottmp.cer release
copy build\bin\%Platform2%\%Configuration%\sys\ottmp.pdb release\symbols
copy build\bin\%Platform2%\%Configuration%\dll\otApi.dll release
copy build\bin\%Platform2%\%Configuration%\dll\otApi.lib release\libs
copy build\bin\%Platform2%\%Configuration%\dll\otApi.pdb release\symbols
copy build\bin\%Platform2%\%Configuration%\dll\otNodeApi.dll release
copy build\bin\%Platform2%\%Configuration%\dll\otNodeApi.lib release\libs
copy build\bin\%Platform2%\%Configuration%\dll\otNodeApi.pdb release\symbols
copy build\bin\%Platform2%\%Configuration%\exe\otCli.exe release
copy build\bin\%Platform2%\%Configuration%\exe\otCli.pdb release\symbols
copy build\bin\%Platform2%\%Configuration%\exe\otTestRunner.exe release
copy build\bin\%Platform2%\%Configuration%\exe\otTestRunner.pdb release\symbols
REM Copy the tools
copy tools\windows\* release
copy tools\windows\%Platform%\otInstall.exe release
copy "C:\Program Files (x86)\Windows Kits\10\Tools\%Platform%\devcon.exe" release
REM Generate the trace format files to decode the WPP logs
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\x64\TracePdb.exe" -f release\symbols\*.pdb -p release\symbols\TraceFormat
popd
-31
View File
@@ -1,31 +0,0 @@
REM
REM Copyright (c) 2016, The OpenThread Authors.
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM 1. Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in the
REM documentation and/or other materials provided with the distribution.
REM 3. Neither the name of the copyright holder nor the
REM names of its contributors may be used to endorse or promote products
REM derived from this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
IF "%Platform%"=="arm" GOTO :EOF
vstest.console /logger:Appveyor /inIsolation /platform:%Platform% build\bin\%Platform2%\%Configuration%\dll\UnitTests.dll
-47
View File
@@ -1,47 +0,0 @@
REM
REM Copyright (c) 2016, The OpenThread Authors.
REM All rights reserved.
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions are met:
REM 1. Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in the
REM documentation and/or other materials provided with the distribution.
REM 3. Neither the name of the copyright holder nor the
REM names of its contributors may be used to endorse or promote products
REM derived from this software without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
IF NOT "%Platform%"=="x64" GOTO :EOF
pushd %APPVEYOR_BUILD_FOLDER%\release
REM Query the driver state
sc query otlwf
REM Run the basic driver test
otTestRunner.exe ..\tests\scripts\thread-cert Test_otLwf* appveyor
REM Grab the logs
mkdir logs
logman stop Thread -ets
copy %SystemRoot%\System32\LogFiles\WMI\Thread.* logs
popd
+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
+4 -2
View File
@@ -5,6 +5,8 @@ coverage:
ignore:
- "tests/*"
- "third_party/*"
- "third_party/**/*"
comment: off
comment:
layout: "diff, flags, files"
after_n_builds: 5
-7
View File
@@ -36,10 +36,3 @@ configure.ac eol=lf
Makefile.am eol=lf
Makefile.in eol=lf
Makefile eol=lf
# Files normalized to always keep Windows line endings
*.vcxproj eol=crlf
*.vcxproj.filters eol=crlf
*.sln eol=crlf
*.rc text eol=crlf
*.inf text eol=crlf
+2 -6
View File
@@ -1,7 +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.
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.
Usage questions? Post questions to [Stack Overflow](http://stackoverflow.com/) using the [[openthread] tag](http://stackoverflow.com/questions/tagged/openthread). We also use Google Groups for discussion and announcements:
* [openthread-announce](https://groups.google.com/forum/#!forum/openthread-announce) - subscribe for release notes and new updates on OpenThread
* [openthread-users](https://groups.google.com/forum/#!forum/openthread-users) - the best place for users to discuss OpenThread and interact with the OpenThread team
* [openthread-devel](https://groups.google.com/forum/#!forum/openthread-devel) - team members discuss the on-going development of OpenThread
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
+19
View File
@@ -0,0 +1,19 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug** A clear and concise description of what the bug is.
**To Reproduce** Information to reproduce the behavior, including:
1. Git commit id
2. IEEE 802.15.4 hardware platform
3. Build steps
4. Network topology
**Expected behavior** A clear and concise description of what you expected to happen.
**Console/log output** If applicable, add console/log output to help explain your problem.
**Additional context** Add any other context about the problem here.
+12
View File
@@ -0,0 +1,12 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is.
**Describe the solution you'd like** A clear and concise description of what you want to happen.
**Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered.
**Additional context** Add any other context or screenshots about the feature request here.
+334
View File
@@ -0,0 +1,334 @@
#
# 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: Build
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'"
pretty:
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 --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
cmake --version | grep 3.10.3
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Build
run: |
OT_NODE_TYPE=rcp ./script/test build
package:
name: package-${{ matrix.compiler }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
compiler_c: gcc
compiler_cpp: g++
- compiler: clang
compiler_c: clang
compiler_cpp: clang++
env:
CC: ${{ matrix.compiler_c }}
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
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Package
run: |
script/test package
scan-build:
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 --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
gcc_download_url: https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-4_9-2015q3
- gcc_ver: 5
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-5_4-2016q3
- gcc_ver: 6
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-6-2017-q2-update
- gcc_ver: 7
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-7-2018-q2-update
- gcc_ver: 9
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
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 gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
tar xjf gcc-arm.tar.bz2
# use the minimal required cmake version
sudo pip3 install --system -U cmake==3.10.3
cmake --version | grep 3.10.3
- name: Build
run: |
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
script/check-arm-build
gcc:
name: gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
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: |
script/check-simulation-build
script/check-posix-build
clang:
name: clang-${{ matrix.clang_ver }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
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/*
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: |
script/check-simulation-build
script/check-posix-build
clang-m32:
name: clang-m32-${{ matrix.clang_ver }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
CFLAGS: -m32 -Wconversion
CXXFLAGS: -m32 -Wconversion
LDFLAGS: -m32
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo dpkg --add-architecture 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-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 --no-install-recommends install -y ninja-build
cd /tmp
wget -O gn.zip https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest
unzip -o gn.zip
chmod a+x gn && mkdir -p bin && mv -f gn bin/
- name: Build
run: |
export PATH=/tmp/bin:$PATH
script/check-gn-build
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: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
rm -f '/usr/local/bin/2to3'
brew update
brew install automake m4 ninja
[ ${{ matrix.CC }} != clang ] || brew install llvm
- name: Build
run: |
export PATH=$(brew --prefix m4)/bin:$PATH
script/check-posix-build
script/check-simulation-build
android:
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
+97
View File
@@ -0,0 +1,97 @@
#
# 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: Docker
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'"
buildx:
name: buildx-${{ matrix.docker_name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- docker_name: environment
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=openthread/${{ matrix.docker_name }}
DOCKER_FILE=etc/docker/${{ matrix.docker_name }}/Dockerfile
DOCKER_PLATFORMS=linux/amd64
VERSION=latest
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--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: Login to DockerHub
if: success() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
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: Inspect Image
if: always() && github.repository == 'openthread/openthread' && github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
+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.
#
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-20.04
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'openthread'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'openthread'
fuzz-seconds: 1800
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure()
with:
name: artifacts
path: ./out/artifacts
+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
+308
View File
@@ -0,0 +1,308 @@
#
# 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: POSIX
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'"
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 lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build
run: |
./bootstrap
make -f examples/Makefile-simulation
make -f src/posix/Makefile-posix
- name: Run
run: |
VERBOSE=1 OT_CLI_PATH="$PWD/output/posix/bin/ot-cli -v" RADIO_DEVICE="$PWD/output/simulation/bin/ot-rcp" make -f src/posix/Makefile-posix check
- uses: actions/upload-artifact@v2
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
ncp-rcp-migrate:
runs-on: ubuntu-20.04
env:
COVERAGE: 1
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y expect lcov
- name: Build
run: |
./bootstrap
script/check-ncp-rcp-migrate build
- name: Run
run: |
script/check-ncp-rcp-migrate check
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
with:
name: cov-ncp-rcp-migrate
path: tmp/coverage.info
pty-linux:
name: pty-linux OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: ubuntu-20.04
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 lcov net-tools ninja-build
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
- name: Build
run: |
script/check-posix-pty build
- name: Run
run: |
script/check-posix-pty check
- 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
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:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'off'
steps:
- uses: actions/checkout@v2
- name: Bootstrap
run: |
rm -f '/usr/local/bin/2to3'
brew update
brew install ninja socat
- name: Build
run: |
script/check-posix-pty build
- name: Run
run: |
script/check-posix-pty check
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
+338
View File
@@ -0,0 +1,338 @@
#
# 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.3
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'"
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.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++", 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 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: |
./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: 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-${{ 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 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: |
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
+64
View File
@@ -0,0 +1,64 @@
#
# 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: Size
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'"
size-report:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bootstrap
if: "github.event_name == 'push'"
run: |
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install mdv
- name: Run
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
+154
View File
@@ -0,0 +1,154 @@
#
# 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: Toranj
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'"
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
sudo apt-get --no-install-recommends install -y autoconf-archive
sudo apt-get --no-install-recommends install -y bsdtar
sudo apt-get --no-install-recommends install -y libtool
sudo apt-get --no-install-recommends install -y libglib2.0-dev
sudo apt-get --no-install-recommends install -y libboost-dev libboost-signals-dev
sudo apt-get --no-install-recommends install -y lcov
script/git-tool clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund
./bootstrap.sh
./configure
sudo make -j2
sudo make install
- name: Build & Run
run: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
- name: Generate Coverage
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-ncp-${{ matrix.TORANJ_RADIO }}
path: tmp/coverage.info
toranj-cli:
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.04
strategy:
matrix:
TORANJ_RADIO: ['15.4']
env:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 1
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 lcov
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh
- name: Generate Coverage
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@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
+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.
#
name: API Version
on: [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'"
api-version:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Check
run: |
script/check-api-version
+20 -2
View File
@@ -1,16 +1,22 @@
*.a
*.bak
*.db
*.flash
*.gcda
*.gcno
*.log
*.o
*.lo
*.la
*.ninja*
*.opendb
*.orig
*.pcap
*.pyc
*.suo
*.swn
*.swo
*.swp
*.trs
*.user
*.bak
@@ -24,13 +30,15 @@
aclocal.m4
autom4te.cache
build
CMakeCache.txt
CMakeFiles
cmake_install.cmake
configure
config.log
config.status
doc/Doxyfile
doc/html
etc/visual-studio/BundleArtifacts
etc/visual-studio/Generated Files
etc/cmake/openthread-config-generic.h
include/openthread-config.h
include/openthread-config.h.in
include/openthread-config-generic.h
@@ -50,3 +58,13 @@ third_party/nlbuild-autotools/repo/third_party/autoconf/m4/ltsugar.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/ltversion.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/m4/lt~obsolete.m4
third_party/nlbuild-autotools/repo/third_party/autoconf/missing
/tmp/
# IDE / editor files
.idea/**
.vscode/**
cmake-build-*/**
/tags
# Python bytecodes
__pycache__
+3
View File
@@ -0,0 +1,3 @@
buildconfig = "//third_party/build_gn/BUILDCONFIG.gn"
check_system_includes = true
+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
+7
View File
@@ -0,0 +1,7 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "never"
}
-138
View File
@@ -1,138 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
language: generic
sudo: required
dist: trusty
before_install:
- .travis/before_install.sh
before_script:
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
fi
script:
- .travis/script.sh
after_success:
- bash <(curl -s https://codecov.io/bash)
matrix:
include:
- env: BUILD_TARGET="posix-distcheck" CC=clang-5.0 CXX=clang++-5.0 VERBOSE=1 VIRTUAL_TIME=1
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
- env: BUILD_TARGET="posix-ncp" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
- env: BUILD_TARGET="posix-mtd" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
- env: BUILD_TARGET="pretty-check"
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- env: BUILD_TARGET="scan-build" CC="clang" CXX="clang++"
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- env: BUILD_TARGET="arm-gcc49"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc54"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc63"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc7"
os: linux
compiler: gcc
- env: BUILD_TARGET="posix" CC=clang-5.0 CXX=clang++-5.0
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- env: BUILD_TARGET="posix" CC="gcc-5" CXX="g++-5"
os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
- g++-5
- env: BUILD_TARGET="posix" CC="gcc-6" CXX="g++-6"
os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-6
- g++-6
- env: BUILD_TARGET="posix" CC="gcc-7" CXX="g++-7"
os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-7
- g++-7
- env: BUILD_TARGET="posix-ncp-spi" VERBOSE=1
os: linux
compiler: gcc
- env: BUILD_TARGET="toranj-test-framework" VERBOSE=1
os: linux
compiler: gcc
-141
View File
@@ -1,141 +0,0 @@
#!/bin/sh
#
# 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.
#
die() {
echo " *** ERROR: " $*
exit 1
}
set -x
cd /tmp || die
[ $TRAVIS_OS_NAME != linux ] || {
sudo apt-get update || die
[ $BUILD_TARGET != posix-distcheck -a $BUILD_TARGET != posix-32-bit -a $BUILD_TARGET != posix-mtd -a $BUILD_TARGET != posix-ncp ] || {
pip install --user --upgrade pip || die
pip install --user -r $TRAVIS_BUILD_DIR/tests/scripts/thread-cert/requirements.txt || die
[ $BUILD_TARGET != posix-ncp ] || {
# Packages used by ncp tools.
pip install --user git+https://github.com/openthread/pyspinel || die
}
}
[ $BUILD_TARGET != pretty-check ] || {
clang-format --version || die
}
[ $BUILD_TARGET != scan-build ] || {
sudo apt-get install clang || die
}
[ $BUILD_TARGET != arm-gcc49 ] || {
sudo apt-get install lib32z1 || die
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc54 ] || {
sudo apt-get install lib32z1 || die
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc63 ] || {
sudo apt-get install lib32z1 || die
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH || die
arm-none-eabi-gcc --version || die
wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2017.03-rc2/arc_gnu_2017.03-rc2_prebuilt_elf32_le_linux_install.tar.gz || die
tar xzf arc_gnu_2017.03-rc2_prebuilt_elf32_le_linux_install.tar.gz
export PATH=/tmp/arc_gnu_2017.03-rc2_prebuilt_elf32_le_linux_install/bin:$PATH || die
arc-elf32-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc7 ] || {
sudo apt-get install lib32z1 || die
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != posix-32-bit -a $BUILD_TARGET != posix-mtd ] || {
sudo apt-get install g++-multilib || die
}
[ $BUILD_TARGET != posix-distcheck ] || {
sudo apt-get install clang || die
sudo apt-get install llvm-3.4-runtime || die
}
[ $BUILD_TARGET != posix -o $CC != clang ] || {
sudo apt-get install clang || die
}
[ $BUILD_TARGET != toranj-test-framework ] || {
# packages for wpantund
sudo apt-get install dbus || die
sudo apt-get install gcc g++ libdbus-1-dev || die
sudo apt-get install autoconf-archive || die
sudo apt-get install bsdtar || die
sudo apt-get install libtool || die
sudo apt-get install libglib2.0-dev || die
sudo apt-get install libboost-dev || die
sudo apt-get install libboost-signals-dev || die
# clone and build wpantund
git clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund || die
./bootstrap.sh || die
./configure || die
sudo make -j 8 || die
sudo make install || die
cd .. || die
}
}
[ $TRAVIS_OS_NAME != osx ] || {
sudo easy_install pexpect || die
[ $BUILD_TARGET != cc2538 ] || {
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 || die
tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
}
-452
View File
@@ -1,452 +0,0 @@
#!/bin/sh
#
# 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.
#
die() {
echo " *** ERROR: " $*
exit 1
}
set -x
[ $BUILD_TARGET != pretty-check ] || {
./bootstrap || die
./configure || die
make pretty-check || die
}
[ $BUILD_TARGET != scan-build ] || {
./bootstrap || die
# avoids "third_party/mbedtls/repo/library/ssl_srv.c:2904:9: warning: Value stored to 'p' is never read"
export CPPFLAGS=-DMBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
scan-build ./configure \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--with-examples=posix \
--enable-application-coap \
--enable-border-router \
--enable-cert-log \
--enable-child-supervision \
--enable-commissioner \
--enable-dhcp6-client \
--enable-dhcp6-server \
--enable-diag \
--enable-dns-client \
--enable-jam-detection \
--enable-joiner \
--enable-legacy \
--enable-mac-filter \
--enable-mtd-network-diagnostic \
--enable-raw-link-api \
--enable-service \
--enable-tmf-proxy || die
scan-build --status-bugs -analyze-headers -v make || die
}
[ $BUILD_TARGET != arm-gcc49 ] || {
export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-kw41z || die
arm-none-eabi-size output/kw41z/bin/ot-cli-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-cli-mtd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-cc2650 || die
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2652 || die
arm-none-eabi-size output/cc2652/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
unzip -qq asf-standalone-archive-3.36.0.58.zip || die
mv xdk-asf-3.36.0 third_party/microchip/asf || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc54 ] || {
export PATH=/tmp/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-kw41z || die
arm-none-eabi-size output/kw41z/bin/ot-cli-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-cli-mtd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-cc2650 || die
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2652 || die
arm-none-eabi-size output/cc2652/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
unzip -qq asf-standalone-archive-3.36.0.58.zip || die
mv xdk-asf-3.36.0 third_party/microchip/asf || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc63 ] || {
export PATH=/tmp/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
# git checkout -- . || die
# git clean -xfd || die
# ./bootstrap || die
# COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
# arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-kw41z || die
arm-none-eabi-size output/kw41z/bin/ot-cli-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-cli-mtd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-cc2650 || die
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2652 || die
arm-none-eabi-size output/cc2652/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
unzip -qq asf-standalone-archive-3.36.0.58.zip || die
mv xdk-asf-3.36.0 third_party/microchip/asf || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
export PATH=/tmp/arc_gnu_2017.03-rc2_prebuilt_elf32_le_linux_install/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-emsk || die
arc-elf32-size output/emsk/bin/ot-cli-ftd || die
arc-elf32-size output/emsk/bin/ot-cli-mtd || die
arc-elf32-size output/emsk/bin/ot-ncp-ftd || die
arc-elf32-size output/emsk/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc7 ] || {
export PATH=/tmp/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2538 || die
arm-none-eabi-size output/cc2538/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
# git checkout -- . || die
# git clean -xfd || die
# ./bootstrap || die
# COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
# arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-kw41z || die
arm-none-eabi-size output/kw41z/bin/ot-cli-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-cli-mtd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-ftd || die
arm-none-eabi-size output/kw41z/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
make -f examples/Makefile-cc2650 || die
arm-none-eabi-size output/cc2650/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2650/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc2652 || die
arm-none-eabi-size output/cc2652/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
unzip -qq asf-standalone-archive-3.36.0.58.zip || die
mv xdk-asf-3.36.0 third_party/microchip/asf || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != posix ] || {
sh -c '$CC --version' || die
sh -c '$CXX --version' || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE make -f examples/Makefile-posix || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG make -f examples/Makefile-posix || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
./configure \
--enable-ncp-app=all \
--with-ncp-bus=spi \
--with-examples=posix \
--enable-border-router \
--enable-child-supervision \
--enable-diag \
--enable-jam-detection \
--enable-legacy \
--enable-mac-filter \
--enable-service \
--enable-channel-manager \
--enable-channel-monitor \
--disable-docs \
--disable-test || die
make -j 8 || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
./configure \
--enable-cli-app=mtd \
--with-ncp-bus=spi \
--with-examples=posix \
--enable-border-router \
--enable-child-supervision \
--enable-legacy \
--enable-mac-filter \
--enable-service \
--disable-docs \
--disable-test || die
make -j 8 || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
./configure \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--with-examples=posix || die
make -j 8 || die
}
[ $BUILD_TARGET != posix-distcheck ] || {
export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer-5.0` || die
export ASAN_OPTIONS=symbolize=1 || die
export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_POSIX_VIRTUAL_TIME=1 || die
./bootstrap || die
make -f examples/Makefile-posix distcheck || die
}
[ $BUILD_TARGET != posix-32-bit ] || {
./bootstrap || die
COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-posix check || die
}
[ $BUILD_TARGET != posix-mtd ] || {
./bootstrap || die
COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-posix check || die
}
[ $BUILD_TARGET != posix-ncp-spi ] || {
./bootstrap || die
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ncp-app=ftd --with-ncp-bus=spi --with-examples=posix" || die
}
[ $BUILD_TARGET != posix-ncp ] || {
./bootstrap || die
NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die
}
[ $BUILD_TARGET != toranj-test-framework ] || {
./tests/toranj/start.sh
}
+2
View File
@@ -14,3 +14,5 @@ Nordic Semiconductor
Texas Instruments Incorporated
NXP Semiconductors
Synopsys, Inc.
Cascoda Limited
Silicon Laboratories, Inc
+630
View File
@@ -0,0 +1,630 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
LOCAL_PATH := $(call my-dir)
ifeq ($(OPENTHREAD_ENABLE_ANDROID_MK),1)
OPENTHREAD_DEFAULT_VERSION := $(shell cat $(LOCAL_PATH)/.default-version)
OPENTHREAD_SOURCE_VERSION := $(shell git -C $(LOCAL_PATH) describe --always --match "[0-9].*" 2> /dev/null)
OPENTHREAD_PROJECT_CFLAGS ?= \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
$(NULL)
OPENTHREAD_PUBLIC_CFLAGS := \
-DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \
-DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \
-DOPENTHREAD_CONFIG_DTLS_ENABLE=1 \
-DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 \
-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 \
-DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \
-DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1 \
-DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \
-DOPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1 \
-DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 \
-DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 \
-DOPENTHREAD_FTD=1 \
-DOPENTHREAD_PLATFORM_POSIX=1 \
-DOPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE=1 \
-DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
$(NULL)
OPENTHREAD_PRIVATE_CFLAGS := \
-DMBEDTLS_CONFIG_FILE=\"mbedtls-config.h\" \
-DPACKAGE=\"openthread\" \
-DPACKAGE_BUGREPORT=\"openthread-devel@googlegroups.com\" \
-DPACKAGE_NAME=\"OPENTHREAD\" \
-DPACKAGE_STRING=\"OPENTHREAD\ $(OPENTHREAD_DEFAULT_VERSION)\" \
-DPACKAGE_TARNAME=\"openthread\" \
-DPACKAGE_URL=\"http://github.com/openthread/openthread\" \
-DPACKAGE_VERSION=\"$(OPENTHREAD_SOURCE_VERSION)\" \
-DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\" \
-DVERSION=\"$(OPENTHREAD_DEFAULT_VERSION)\" \
$(NULL)
# Enable required features for on-device tests.
ifeq ($(TARGET_BUILD_VARIANT),eng)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \
$(NULL)
endif
ifeq ($(USE_OTBR_DAEMON), 1)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1 \
-DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1 \
-DOPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=1 \
$(NULL)
else
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1
endif
ifeq ($(USE_OT_RCP_BUS), spi)
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_SPI
else
OPENTHREAD_PUBLIC_CFLAGS += -DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_UART
endif
# Enable all optional features for CI tests.
ifeq ($(TARGET_PRODUCT),generic)
OPENTHREAD_PUBLIC_CFLAGS += \
-DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \
-DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \
-DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \
-DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=0 \
-DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 \
$(NULL)
endif
include $(CLEAR_VARS)
LOCAL_MODULE := spi-hdlc-adapter
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := tools/spi-hdlc-adapter/spi-hdlc-adapter.c
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-core
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(LOCAL_PATH)/third_party/mbedtls/repo/library \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_EXPORT_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-Wno-error=non-virtual-dtor \
-pedantic-errors \
$(NULL)
ifeq ($(ANDROID_NDK),1)
LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_CFLAGS += \
-DOPENTHREAD_ENABLE_ANDROID_NDK=1 \
-Wno-sign-compare \
$(NULL)
endif
LOCAL_SRC_FILES := \
src/core/api/backbone_router_api.cpp \
src/core/api/backbone_router_ftd_api.cpp \
src/core/api/border_agent_api.cpp \
src/core/api/border_router_api.cpp \
src/core/api/channel_manager_api.cpp \
src/core/api/channel_monitor_api.cpp \
src/core/api/child_supervision_api.cpp \
src/core/api/coap_api.cpp \
src/core/api/coap_secure_api.cpp \
src/core/api/commissioner_api.cpp \
src/core/api/crypto_api.cpp \
src/core/api/dataset_api.cpp \
src/core/api/dataset_ftd_api.cpp \
src/core/api/dataset_updater_api.cpp \
src/core/api/diags_api.cpp \
src/core/api/dns_api.cpp \
src/core/api/dns_server_api.cpp \
src/core/api/error_api.cpp \
src/core/api/heap_api.cpp \
src/core/api/history_tracker_api.cpp \
src/core/api/icmp6_api.cpp \
src/core/api/instance_api.cpp \
src/core/api/ip6_api.cpp \
src/core/api/jam_detection_api.cpp \
src/core/api/joiner_api.cpp \
src/core/api/link_api.cpp \
src/core/api/link_metrics_api.cpp \
src/core/api/link_raw_api.cpp \
src/core/api/logging_api.cpp \
src/core/api/message_api.cpp \
src/core/api/multi_radio_api.cpp \
src/core/api/netdata_api.cpp \
src/core/api/netdata_publisher_api.cpp \
src/core/api/netdiag_api.cpp \
src/core/api/network_time_api.cpp \
src/core/api/ping_sender_api.cpp \
src/core/api/random_crypto_api.cpp \
src/core/api/random_noncrypto_api.cpp \
src/core/api/server_api.cpp \
src/core/api/sntp_api.cpp \
src/core/api/srp_client_api.cpp \
src/core/api/srp_client_buffers_api.cpp \
src/core/api/srp_server_api.cpp \
src/core/api/tasklet_api.cpp \
src/core/api/tcp_api.cpp \
src/core/api/thread_api.cpp \
src/core/api/thread_ftd_api.cpp \
src/core/api/trel_api.cpp \
src/core/api/udp_api.cpp \
src/core/backbone_router/backbone_tmf.cpp \
src/core/backbone_router/bbr_leader.cpp \
src/core/backbone_router/bbr_local.cpp \
src/core/backbone_router/bbr_manager.cpp \
src/core/backbone_router/multicast_listeners_table.cpp \
src/core/backbone_router/ndproxy_table.cpp \
src/core/border_router/infra_if.cpp \
src/core/border_router/routing_manager.cpp \
src/core/coap/coap.cpp \
src/core/coap/coap_message.cpp \
src/core/coap/coap_secure.cpp \
src/core/common/appender.cpp \
src/core/common/binary_search.cpp \
src/core/common/crc16.cpp \
src/core/common/data.cpp \
src/core/common/error.cpp \
src/core/common/heap.cpp \
src/core/common/heap_data.cpp \
src/core/common/heap_string.cpp \
src/core/common/instance.cpp \
src/core/common/log.cpp \
src/core/common/message.cpp \
src/core/common/notifier.cpp \
src/core/common/random.cpp \
src/core/common/settings.cpp \
src/core/common/string.cpp \
src/core/common/tasklet.cpp \
src/core/common/time_ticker.cpp \
src/core/common/timer.cpp \
src/core/common/tlvs.cpp \
src/core/common/trickle_timer.cpp \
src/core/common/uptime.cpp \
src/core/crypto/aes_ccm.cpp \
src/core/crypto/aes_ecb.cpp \
src/core/crypto/crypto_platform.cpp \
src/core/crypto/ecdsa.cpp \
src/core/crypto/ecdsa_tinycrypt.cpp \
src/core/crypto/hkdf_sha256.cpp \
src/core/crypto/hmac_sha256.cpp \
src/core/crypto/mbedtls.cpp \
src/core/crypto/pbkdf2_cmac.cpp \
src/core/crypto/sha256.cpp \
src/core/crypto/storage.cpp \
src/core/diags/factory_diags.cpp \
src/core/mac/channel_mask.cpp \
src/core/mac/data_poll_handler.cpp \
src/core/mac/data_poll_sender.cpp \
src/core/mac/link_raw.cpp \
src/core/mac/mac.cpp \
src/core/mac/mac_filter.cpp \
src/core/mac/mac_frame.cpp \
src/core/mac/mac_links.cpp \
src/core/mac/mac_types.cpp \
src/core/mac/sub_mac.cpp \
src/core/mac/sub_mac_callbacks.cpp \
src/core/meshcop/announce_begin_client.cpp \
src/core/meshcop/border_agent.cpp \
src/core/meshcop/commissioner.cpp \
src/core/meshcop/dataset.cpp \
src/core/meshcop/dataset_local.cpp \
src/core/meshcop/dataset_manager.cpp \
src/core/meshcop/dataset_manager_ftd.cpp \
src/core/meshcop/dataset_updater.cpp \
src/core/meshcop/dtls.cpp \
src/core/meshcop/energy_scan_client.cpp \
src/core/meshcop/extended_panid.cpp \
src/core/meshcop/joiner.cpp \
src/core/meshcop/joiner_router.cpp \
src/core/meshcop/meshcop.cpp \
src/core/meshcop/meshcop_leader.cpp \
src/core/meshcop/meshcop_tlvs.cpp \
src/core/meshcop/network_name.cpp \
src/core/meshcop/panid_query_client.cpp \
src/core/meshcop/timestamp.cpp \
src/core/net/checksum.cpp \
src/core/net/dhcp6_client.cpp \
src/core/net/dhcp6_server.cpp \
src/core/net/dns_client.cpp \
src/core/net/dns_dso.cpp \
src/core/net/dns_types.cpp \
src/core/net/dnssd_server.cpp \
src/core/net/icmp6.cpp \
src/core/net/ip4_address.cpp \
src/core/net/ip6.cpp \
src/core/net/ip6_address.cpp \
src/core/net/ip6_filter.cpp \
src/core/net/ip6_headers.cpp \
src/core/net/ip6_mpl.cpp \
src/core/net/nd6.cpp \
src/core/net/nd_agent.cpp \
src/core/net/netif.cpp \
src/core/net/sntp_client.cpp \
src/core/net/socket.cpp \
src/core/net/srp_client.cpp \
src/core/net/srp_server.cpp \
src/core/net/tcp6.cpp \
src/core/net/udp6.cpp \
src/core/radio/radio.cpp \
src/core/radio/radio_callbacks.cpp \
src/core/radio/radio_platform.cpp \
src/core/radio/trel_interface.cpp \
src/core/radio/trel_link.cpp \
src/core/radio/trel_packet.cpp \
src/core/thread/address_resolver.cpp \
src/core/thread/announce_begin_server.cpp \
src/core/thread/announce_sender.cpp \
src/core/thread/anycast_locator.cpp \
src/core/thread/child_table.cpp \
src/core/thread/csl_tx_scheduler.cpp \
src/core/thread/discover_scanner.cpp \
src/core/thread/dua_manager.cpp \
src/core/thread/energy_scan_server.cpp \
src/core/thread/indirect_sender.cpp \
src/core/thread/key_manager.cpp \
src/core/thread/link_metrics.cpp \
src/core/thread/link_quality.cpp \
src/core/thread/lowpan.cpp \
src/core/thread/mesh_forwarder.cpp \
src/core/thread/mesh_forwarder_ftd.cpp \
src/core/thread/mesh_forwarder_mtd.cpp \
src/core/thread/mle.cpp \
src/core/thread/mle_router.cpp \
src/core/thread/mle_types.cpp \
src/core/thread/mlr_manager.cpp \
src/core/thread/neighbor_table.cpp \
src/core/thread/network_data.cpp \
src/core/thread/network_data_leader.cpp \
src/core/thread/network_data_leader_ftd.cpp \
src/core/thread/network_data_local.cpp \
src/core/thread/network_data_notifier.cpp \
src/core/thread/network_data_publisher.cpp \
src/core/thread/network_data_service.cpp \
src/core/thread/network_data_tlvs.cpp \
src/core/thread/network_data_types.cpp \
src/core/thread/network_diagnostic.cpp \
src/core/thread/panid_query_server.cpp \
src/core/thread/radio_selector.cpp \
src/core/thread/router_table.cpp \
src/core/thread/src_match_controller.cpp \
src/core/thread/thread_netif.cpp \
src/core/thread/time_sync_service.cpp \
src/core/thread/tmf.cpp \
src/core/thread/topology.cpp \
src/core/thread/uri_paths.cpp \
src/core/utils/channel_manager.cpp \
src/core/utils/channel_monitor.cpp \
src/core/utils/child_supervision.cpp \
src/core/utils/flash.cpp \
src/core/utils/heap.cpp \
src/core/utils/history_tracker.cpp \
src/core/utils/jam_detector.cpp \
src/core/utils/otns.cpp \
src/core/utils/parse_cmdline.cpp \
src/core/utils/ping_sender.cpp \
src/core/utils/slaac_address.cpp \
src/core/utils/srp_client_buffers.cpp \
src/lib/hdlc/hdlc.cpp \
src/lib/platform/exit_code.c \
src/lib/spinel/spinel.c \
src/lib/spinel/spinel_decoder.cpp \
src/lib/spinel/spinel_encoder.cpp \
src/lib/url/url.cpp \
src/posix/platform/alarm.cpp \
src/posix/platform/backbone.cpp \
src/posix/platform/daemon.cpp \
src/posix/platform/entropy.cpp \
src/posix/platform/firewall.cpp \
src/posix/platform/hdlc_interface.cpp \
src/posix/platform/infra_if.cpp \
src/posix/platform/logging.cpp \
src/posix/platform/mainloop.cpp \
src/posix/platform/memory.cpp \
src/posix/platform/misc.cpp \
src/posix/platform/multicast_routing.cpp \
src/posix/platform/netif.cpp \
src/posix/platform/radio.cpp \
src/posix/platform/radio_url.cpp \
src/posix/platform/settings.cpp \
src/posix/platform/spi_interface.cpp \
src/posix/platform/system.cpp \
src/posix/platform/trel.cpp \
src/posix/platform/udp.cpp \
src/posix/platform/utils.cpp \
third_party/mbedtls/repo/library/aes.c \
third_party/mbedtls/repo/library/aesni.c \
third_party/mbedtls/repo/library/arc4.c \
third_party/mbedtls/repo/library/aria.c \
third_party/mbedtls/repo/library/asn1parse.c \
third_party/mbedtls/repo/library/asn1write.c \
third_party/mbedtls/repo/library/base64.c \
third_party/mbedtls/repo/library/bignum.c \
third_party/mbedtls/repo/library/blowfish.c \
third_party/mbedtls/repo/library/camellia.c \
third_party/mbedtls/repo/library/ccm.c \
third_party/mbedtls/repo/library/certs.c \
third_party/mbedtls/repo/library/chacha20.c \
third_party/mbedtls/repo/library/chachapoly.c \
third_party/mbedtls/repo/library/cipher.c \
third_party/mbedtls/repo/library/cipher_wrap.c \
third_party/mbedtls/repo/library/cmac.c \
third_party/mbedtls/repo/library/constant_time.c \
third_party/mbedtls/repo/library/ctr_drbg.c \
third_party/mbedtls/repo/library/debug.c \
third_party/mbedtls/repo/library/des.c \
third_party/mbedtls/repo/library/dhm.c \
third_party/mbedtls/repo/library/ecdh.c \
third_party/mbedtls/repo/library/ecdsa.c \
third_party/mbedtls/repo/library/ecjpake.c \
third_party/mbedtls/repo/library/ecp.c \
third_party/mbedtls/repo/library/ecp_curves.c \
third_party/mbedtls/repo/library/entropy.c \
third_party/mbedtls/repo/library/entropy_poll.c \
third_party/mbedtls/repo/library/error.c \
third_party/mbedtls/repo/library/gcm.c \
third_party/mbedtls/repo/library/havege.c \
third_party/mbedtls/repo/library/hkdf.c \
third_party/mbedtls/repo/library/hmac_drbg.c \
third_party/mbedtls/repo/library/md.c \
third_party/mbedtls/repo/library/md2.c \
third_party/mbedtls/repo/library/md4.c \
third_party/mbedtls/repo/library/md5.c \
third_party/mbedtls/repo/library/memory_buffer_alloc.c \
third_party/mbedtls/repo/library/net_sockets.c \
third_party/mbedtls/repo/library/nist_kw.c \
third_party/mbedtls/repo/library/oid.c \
third_party/mbedtls/repo/library/padlock.c \
third_party/mbedtls/repo/library/pem.c \
third_party/mbedtls/repo/library/pk.c \
third_party/mbedtls/repo/library/pk_wrap.c \
third_party/mbedtls/repo/library/pkcs11.c \
third_party/mbedtls/repo/library/pkcs12.c \
third_party/mbedtls/repo/library/pkcs5.c \
third_party/mbedtls/repo/library/pkparse.c \
third_party/mbedtls/repo/library/pkwrite.c \
third_party/mbedtls/repo/library/platform.c \
third_party/mbedtls/repo/library/platform_util.c \
third_party/mbedtls/repo/library/poly1305.c \
third_party/mbedtls/repo/library/psa_crypto.c \
third_party/mbedtls/repo/library/psa_crypto_driver_wrappers.c \
third_party/mbedtls/repo/library/psa_crypto_se.c \
third_party/mbedtls/repo/library/psa_crypto_slot_management.c \
third_party/mbedtls/repo/library/psa_crypto_storage.c \
third_party/mbedtls/repo/library/psa_its_file.c \
third_party/mbedtls/repo/library/ripemd160.c \
third_party/mbedtls/repo/library/rsa.c \
third_party/mbedtls/repo/library/rsa_internal.c \
third_party/mbedtls/repo/library/sha1.c \
third_party/mbedtls/repo/library/sha256.c \
third_party/mbedtls/repo/library/sha512.c \
third_party/mbedtls/repo/library/ssl_cache.c \
third_party/mbedtls/repo/library/ssl_ciphersuites.c \
third_party/mbedtls/repo/library/ssl_cli.c \
third_party/mbedtls/repo/library/ssl_cookie.c \
third_party/mbedtls/repo/library/ssl_msg.c \
third_party/mbedtls/repo/library/ssl_srv.c \
third_party/mbedtls/repo/library/ssl_ticket.c \
third_party/mbedtls/repo/library/ssl_tls.c \
third_party/mbedtls/repo/library/ssl_tls13_keys.c \
third_party/mbedtls/repo/library/threading.c \
third_party/mbedtls/repo/library/timing.c \
third_party/mbedtls/repo/library/version.c \
third_party/mbedtls/repo/library/version_features.c \
third_party/mbedtls/repo/library/x509.c \
third_party/mbedtls/repo/library/x509_create.c \
third_party/mbedtls/repo/library/x509_crl.c \
third_party/mbedtls/repo/library/x509_crt.c \
third_party/mbedtls/repo/library/x509_csr.c \
third_party/mbedtls/repo/library/x509write_crt.c \
third_party/mbedtls/repo/library/x509write_csr.c \
third_party/mbedtls/repo/library/xtea.c \
third_party/tcplp/bsdtcp/tcp_usrreq.c \
third_party/tcplp/bsdtcp/tcp_subr.c \
third_party/tcplp/bsdtcp/tcp_output.c \
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
third_party/tcplp/bsdtcp/tcp_reass.c \
third_party/tcplp/bsdtcp/tcp_timewait.c \
third_party/tcplp/bsdtcp/tcp_sack.c \
third_party/tcplp/bsdtcp/tcp_input.c \
third_party/tcplp/bsdtcp/tcp_timer.c \
third_party/tcplp/lib/bitmap.c \
third_party/tcplp/lib/cbuf.c \
third_party/tcplp/lib/lbuf.c \
$(OPENTHREAD_PROJECT_SRC_FILES) \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenthread-cli
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_SRC_FILES := \
src/cli/cli.cpp \
src/cli/cli_coap.cpp \
src/cli/cli_coap_secure.cpp \
src/cli/cli_commissioner.cpp \
src/cli/cli_dataset.cpp \
src/cli/cli_history.cpp \
src/cli/cli_joiner.cpp \
src/cli/cli_network_data.cpp \
src/cli/cli_output.cpp \
src/cli/cli_srp_client.cpp \
src/cli/cli_srp_server.cpp \
src/cli/cli_tcp.cpp \
src/cli/cli_udp.cpp \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-cli
LOCAL_MODULE_TAGS := eng
ifneq ($(ANDROID_NDK),1)
LOCAL_SHARED_LIBRARIES := libcutils
endif
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_LDLIBS := \
-lrt \
-lutil
LOCAL_SRC_FILES := \
src/posix/cli_readline.cpp \
src/posix/cli_stdio.cpp \
src/posix/main.c \
$(NULL)
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core
include $(BUILD_EXECUTABLE)
ifeq ($(USE_OTBR_DAEMON), 1)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-ctl
LOCAL_MODULE_TAGS := eng
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
$(NULL)
LOCAL_CFLAGS := \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
$(NULL)
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src/ \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(NULL)
LOCAL_SRC_FILES := src/posix/client.cpp
include $(BUILD_EXECUTABLE)
endif # ($(USE_OTBR_DAEMON), 1)
ifneq ($(OPENTHREAD_PROJECT_ANDROID_MK),)
include $(OPENTHREAD_PROJECT_ANDROID_MK)
endif
endif # ($(OPENTHREAD_ENABLE_ANDROID_MK),1)
+111
View File
@@ -0,0 +1,111 @@
# 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.
#
import("etc/gn/openthread.gni")
config("openthread_config") {
defines = []
if (openthread_config_file != "") {
defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
}
include_dirs = openthread_project_include_dirs
include_dirs += [
"${root_gen_dir}/include",
"include",
]
}
config("openthread_ftd_config") {
defines = [
"OPENTHREAD_FTD=1",
"OPENTHREAD_MTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_mtd_config") {
defines = [
"OPENTHREAD_MTD=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_radio_config") {
defines = [
"OPENTHREAD_RADIO=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_MTD=0",
]
}
group("libopenthread-ftd") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-ftd" ]
}
group("libopenthread-mtd") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-mtd" ]
}
group("libopenthread-radio") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-radio" ]
}
group("libopenthread-cli-ftd") {
public_deps = [ "include/openthread" ]
deps = [ "src/cli:libopenthread-cli-ftd" ]
}
group("libopenthread-cli-mtd") {
public_deps = [ "include/openthread" ]
deps = [ "src/cli:libopenthread-cli-mtd" ]
}
group("libopenthread-spinel-ncp") {
public_deps = [ "src/lib/spinel:spinel-api" ]
deps = [ "src/lib/spinel:libopenthread-spinel-ncp" ]
}
group("libopenthread-spinel-rcp") {
public_deps = [ "src/lib/spinel:spinel-api" ]
deps = [ "src/lib/spinel:libopenthread-spinel-rcp" ]
}
if (current_os == "fuchsia") {
group("lib-ot-core") {
public_deps = [
":libopenthread-ftd",
"src/core:libopenthread-ftd",
"src/ncp:libopenthread-ncp-ftd",
]
}
}
+214
View File
@@ -0,0 +1,214 @@
#
# 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.
#
cmake_policy(SET CMP0048 NEW)
cmake_minimum_required(VERSION 3.10.2)
file(READ .default-version OT_DEFAULT_VERSION)
string(STRIP ${OT_DEFAULT_VERSION} OT_DEFAULT_VERSION)
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
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/core
)
include(TestBigEndian)
TEST_BIG_ENDIAN(OT_BIG_ENDIAN)
if(OT_BIG_ENDIAN)
target_compile_definitions(ot-config INTERFACE "BYTE_ORDER_BIG_ENDIAN=1")
endif()
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)
set(OT_CFLAGS -Werror -pedantic-errors)
endif()
if(OT_COVERAGE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_COVERAGE=1")
target_compile_options(ot-config INTERFACE -g -O0 --coverage)
target_link_libraries(ot-config INTERFACE --coverage)
endif()
set(OT_CFLAGS
$<$<COMPILE_LANGUAGE:C>:${OT_CFLAGS} -Wall -Wextra -Wshadow>
$<$<COMPILE_LANGUAGE:CXX>:${OT_CFLAGS} -Wall -Wextra -Wshadow -Wno-c++14-compat -fno-exceptions>
)
endif()
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}")
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.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()
set(OT_PLATFORM "NO" CACHE STRING "Target platform chosen by the user at configure time")
ot_get_platforms(OT_PLATFORMS)
set_property(CACHE OT_PLATFORM PROPERTY STRINGS ${OT_PLATFORMS})
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"
"NONE"
"PLATFORM_DEFINED"
)
if(OT_REFERENCE_DEVICE AND NOT OT_PLATFORM STREQUAL "posix")
set(OT_LOG_OUTPUT "APP" CACHE STRING "Set log output to application for reference device")
else()
set(OT_LOG_OUTPUT "" CACHE STRING "Where log output goes to")
endif()
set_property(CACHE OT_LOG_OUTPUT PROPERTY STRINGS ${OT_LOG_OUTPUT_VALUES})
if(OT_LOG_OUTPUT)
if(NOT OT_LOG_OUTPUT IN_LIST OT_LOG_OUTPUT_VALUES)
message(FATAL_ERROR "Log output unknown: ${OT_LOG_OUTPUT}")
endif()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_${OT_LOG_OUTPUT}")
message(STATUS "Log output: ${OT_LOG_OUTPUT}")
endif()
# 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 OpenThread config header
# file instead.
set(OT_CONFIG "" CACHE STRING "OpenThread project-specific config header file chosen by user at configure time")
list(APPEND OT_PUBLIC_INCLUDES ${PROJECT_BINARY_DIR}/etc/cmake)
list(APPEND OT_PUBLIC_INCLUDES ${PROJECT_SOURCE_DIR}/etc/cmake)
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 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_CONFIG_FILE=\"${OT_CONFIG}\"")
message(STATUS "OpenThread Config File: \"${OT_CONFIG}\"")
endif()
target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES})
if(OT_PLATFORM STREQUAL "posix")
if(OT_BUILD_EXECUTABLES)
add_subdirectory(src/posix)
else()
add_subdirectory(src/posix EXCLUDE_FROM_ALL)
endif()
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()
endif()
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
)
+18 -46
View File
@@ -2,73 +2,45 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at openthread-conduct@google.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at openthread-conduct@google.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
+83 -36
View File
@@ -2,21 +2,22 @@
We would love for you to contribute to OpenThread and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow.
* [1 Code of Conduct](#code-of-conduct)
* [2 Bugs](#bugs)
* [3 New Features](#new-features)
* [4 Contributing Code](#contributing-code)
* [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)
- [1 Code of Conduct](#code-of-conduct)
- [2 Bugs](#bugs)
- [3 New Features](#new-features)
- [4 Contributing Code](#contributing-code)
- [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
Help us keep OpenThread open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).
Help us keep OpenThread open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).
## Bugs
If you find a bug in the source code, you can help us by [submitting a GitHub Issue](https://github.com/openthread/openthread/issues/new). The best bug reports provide a detailed description of the issue and step-by-step instructions for predictably reproducing the issue. Even better, you can [submit a Pull Request](#submitting-a-pull-request) with a fix.
If you find a bug in the source code, you can help us by [submitting a GitHub Issue](https://github.com/openthread/openthread/issues/new). The best bug reports provide a detailed description of the issue and step-by-step instructions for predictably reproducing the issue. Even better, you can [submit a Pull Request](#submitting-a-pull-request) with a fix.
## New Features
@@ -24,9 +25,9 @@ You can request a new feature by [submitting a GitHub Issue](https://github.com/
If you would like to implement a new feature, please consider the scope of the new feature:
* *Large feature*: first [submit a GitHub Issue](https://github.com/openthread/openthread/issues/new) and communicate your proposal so that the community can review and provide feedback. Getting early feedback will help ensure your implementation work is accepted by the community. This will also allow us to better coordinate our efforts and minimize duplicated effort.
- _Large feature_: first [submit a GitHub Issue](https://github.com/openthread/openthread/issues/new) and communicate your proposal so that the community can review and provide feedback. Getting early feedback will help ensure your implementation work is accepted by the community. This will also allow us to better coordinate our efforts and minimize duplicated effort.
* *Small feature*: can be implemented and directly [submitted as a Pull Request](#submitting-a-pull-request).
- _Small feature_: can be implemented and directly [submitted as a Pull Request](#submitting-a-pull-request).
## Contributing Code
@@ -37,7 +38,6 @@ The OpenThread Project follows the "Fork-and-Pull" model for accepting contribut
Setup your GitHub fork and continuous-integration services:
1. Fork the [OpenThread repository](https://github.com/openthread/openthread) by clicking "Fork" on the web UI.
2. Enable [Travis CI](https://travis-ci.org/) and [AppVeyor](https://ci.appveyor.com/) by logging in the respective services with your GitHub account and enabling your newly created fork. We use Travis CI for Linux-based continuous integration checks and AppVeyor for Windows-based continuous integration checks. All contributions must pass these checks to be accepted.
Setup your local development environment:
@@ -51,12 +51,9 @@ git remote add upstream git@github.com:openthread/openthread.git
### Contributor License Agreement (CLA)
The OpenThread Project requires all contributors to sign a Contributor License Agreement ([individual](https://developers.google.com/open-source/cla/individual) or [corporate](https://developers.google.com/open-source/cla/corporate)) in order to protect contributors, users, and Google in issues of intellectual property.
With each Pull Request, an automated check occurs to verify that you have signed the CLA. Make sure that you sign the CLA with the same email address associated with your commits (i.e. via the `user.email` Git config as described on GitHub's [Set up Git](https://help.github.com/articles/set-up-git/) page.
NOTE: Only original source code from you and other people that have signed the CLA can be accepted into the repository. This policy does not apply to [third_party](https://github.com/openthread/openthread/tree/master/third_party).
Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to <https://cla.developers.google.com/> to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
### Submitting a Pull Request
@@ -66,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>
@@ -88,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:
@@ -105,24 +102,16 @@ 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 the `make pretty` and `make pretty-check` targets to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1) for `make pretty` and `make pretty-check`.
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 `make pretty-check` to ensure that your code passes the baseline code style checks.
```bash
./bootstrap
./configure
make pretty-check
```
Make sure to include any code format changes in your commits.
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.
#### Push and Test
@@ -134,8 +123,66 @@ git checkout <branch-name>
git push origin <branch-name>
```
This will trigger the Travis CI and AppVeyor continuous-integration checks. You can view the results in the respective services. Note that the integration checks will report failures on occasion. If a failure occurs, you may try rerunning the test via the Travis and/or AppVeyor web UI.
This will trigger continuous-integration checks using GitHub Actions. You can view the status and logs via the "Actions" tab in your fork.
#### Submit Pull Request
Once you've validated the Travis CI and AppVeyor results, 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.
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.
+8 -23
View File
@@ -32,26 +32,19 @@ AM_MAKEFLAGS = --no-print-directory
AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-address-sanitizer \
--enable-application-coap \
--enable-border-router \
--enable-cli-app=all \
--enable-commissioner \
--enable-dhcp6-client \
--enable-dhcp6-server \
--enable-diag \
--enable-dns-client \
--enable-joiner \
--enable-mac-filter \
--enable-ncp-app=all \
--enable-service \
--with-examples=posix \
--with-ncp-bus=uart \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-radio-cli \
--with-examples=simulation \
$(NULL)
SUBDIRS = \
include \
src \
third_party \
src \
examples \
tests \
tools \
@@ -79,14 +72,6 @@ DISTCLEANFILES = \
.local-version \
$(NULL)
PRETTY_SUBDIRS = \
examples \
include \
src \
tests \
tools \
$(NULL)
# Ignore the pseudo flash files on Posix platform during diskcheck
distcleancheck_listfiles = \
$(AM_V_at)find . -type f -name "*flash"
+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
+29 -35
View File
@@ -1,61 +1,58 @@
[![OpenThread][ot-logo]][ot-repo]
[![Build Status][ot-travis-svg]][ot-travis]
[![Build Status][ot-appveyor-svg]][ot-appveyor]
[![Coverage Status][ot-codecov-svg]][ot-codecov]
[![OpenThread][ot-logo]][ot-repo] [![Build][ot-gh-action-build-svg]][ot-gh-action-build] [![Simulation][ot-gh-action-simulation-svg]][ot-gh-action-simulation] [![Docker][ot-gh-action-docker-svg]][ot-gh-action-docker] [![Language grade: C/C++][ot-lgtm-svg]][ot-lgtm] [![Coverage Status][ot-codecov-svg]][ot-codecov]
---
# What is OpenThread?
OpenThread 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.** 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/borderrouter) 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-travis]: https://travis-ci.org/openthread/openthread
[ot-travis-svg]: https://travis-ci.org/openthread/openthread.svg?branch=master
[ot-appveyor]: https://ci.appveyor.com/project/jwhui/openthread
[ot-appveyor-svg]: https://ci.appveyor.com/api/projects/status/r5qwyhn9p26nmfk3?svg=true
[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?
Led by Nest, the following companies are contributing to the ongoing development of OpenThread:
<a href="https://developer.android.com/things/index.html"><img src="doc/images/ot-contrib-at.png" alt="Android Things" width="200px"></a><a href="https://www.arm.com/"><img src="doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="http://www.dialog-semiconductor.com/"><img src="doc/images/ot-contrib-dialog.png" alt="Dialog" width="200px"></a><a href="https://www.microsoft.com/en-us/"><img src="doc/images/ot-contrib-ms.png" alt="Microsoft" width="200px"></a><br /><a href="https://nest.com/"><img src="doc/images/ot-contrib-nest.png" alt="Nest" 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><br /><a href="https://www.qualcomm.com/"><img src="doc/images/ot-contrib-qc.png" alt="Qualcomm" 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
All end-user documentation and guides are located at [openthread.io](https://openthread.io). If you're looking to do things like...
* Learn more about OpenThread features and enhancements
* Use OpenThread in your products
* Learn how to build and configure a Thread network
* Port OpenThread to a new platform
* Build an application on top of OpenThread
* Certify a product using OpenThread
- Learn more about OpenThread features and enhancements
- Use OpenThread in your products
- Learn how to build and configure a Thread network
- Port OpenThread to a new platform
- Build an application on top of OpenThread
- Certify a product using OpenThread
...then [openthread.io](https://openthread.io) is the place for you.
> Note: For users in China, end-user documentation is available at [openthread.google.cn](https://openthread.google.cn).
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
@@ -63,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.
- Bugs and feature requests — [submit to the Issue Tracker](https://github.com/openthread/openthread/issues)
- Community Discussion - [ask questions, share ideas, and engage with other community members](https://github.com/openthread/openthread/discussions)
+41 -29
View File
@@ -1,15 +1,15 @@
# OpenThread Coding Conventions and Style
* [1 C and C++](#c-and-c)
* [1.1 Standards](#standards)
* [1.2 Conventions and Best Practices](#conventions-and-best-practices)
* [1.3 Tightly-constrained Systems and Shared Infrastructure](#tightly-constrained-systems-and-shared-infrastructure)
* [1.4 Format and Style](#format-and-style)
* [1.5 Comments](#comments)
* [2 Python](#python)
* [2.1 Standards](#standards)
* [2.2 Conventions and Best Practices](#conventions-and-best-practices)
* [2.3 Format and Style](#format-and-style)
- [1 C and C++](#c-and-c)
- [1.1 Standards](#standards)
- [1.2 Conventions and Best Practices](#conventions-and-best-practices)
- [1.3 Tightly-constrained Systems and Shared Infrastructure](#tightly-constrained-systems-and-shared-infrastructure)
- [1.4 Format and Style](#format-and-style)
- [1.5 Comments](#comments)
- [2 Python](#python)
- [2.1 Standards](#standards)
- [2.2 Conventions and Best Practices](#conventions-and-best-practices)
- [2.3 Format and Style](#format-and-style)
# C and C++
@@ -18,7 +18,7 @@
- C
- OpenThread uses and enforces the ISO9899:1999 (aka ISO C99, C99) C language standard as the minimum.
- C++
- OpenThread uses and enforces the ISO14882:2003 (aka ISO C++03, C++03) C++ language standard as the minimum.
- OpenThread uses and enforces the ISO14882:2011 (aka ISO C++11, C++11) C++ language standard as the minimum.
- Extensions
- Wherever possible, toolchain-specific (e.g GCC/GNU) extensions or the use of later standards shall be avoided or shall be leveraged through toolchain-compatibility preprocessor macros.
@@ -27,13 +27,13 @@
### Language Independent
- Inline functions should be used judiciously.
- The use of code in headers and, more specifically, the use of the non-local scope inline functions should be avoided. Exception: Simple setters and getters are fine since the compiler can efficiently optimize these and make their overhead as low as a direct data member access.
- The use of code in headers and, more specifically, the use of the non-local scope inline functions should be avoided. Exception: Simple setters and getters are fine since the compiler can efficiently optimize these and make their overhead as low as a direct data member access.
- Return Statements
- There should be one return statement per free function or method at the end of the free function or method.
- Non-local Goto
- There should be no calls to the functions `setjmp` or `longjmp`.
- Local Goto
- There should be no calls to the C/C++ keyword goto. Exception: The use of local gotos for the purposes of common error handling blocks and single points of function return at the bottom of a function.
- There should be no calls to the C/C++ keyword goto. Exception: The use of local gotos for the purposes of common error handling blocks and single points of function return at the bottom of a function.
- C Preprocessor
- Use of the C preprocessor should be limited to file inclusion and simple macros.
- Macros shall not be defined within a function or a block and should be defined at the top of a file.
@@ -63,18 +63,20 @@
- Unbounded Recursion
- There shall be no direct or indirect use of unbounded recursive function calls.
- Symmetric APIs
- Wherever possible and appropriate, particularly around the management of resources, APIs should be symmetric. For example, if there is a free function or object method that allocates a resource, then there should be one that deallocates it. If there is a free function or object method that opens a file or network stream, then there should be one that closes it.
- Wherever possible and appropriate, particularly around the management of resources, APIs should be symmetric. For example, if there is a free function or object method that allocates a resource, then there should be one that deallocates it. If there is a free function or object method that opens a file or network stream, then there should be one that closes it.
- Use C stdint.h or C++ cstdint for Plain Old Data Types
- Standard, scalar data types defined in stdint.h (C) or cstdint (C++) should be used for basic signed and unsigned integer types, especially when size and serialization to non-volatile storage or across a network is concerned. Examples of these are: `uint8_t`, `int8_t`, etc.
- Standard, scalar data types defined in stdint.h (C) or cstdint (C++) should be used for basic signed and unsigned integer types, especially when size and serialization to non-volatile storage or across a network is concerned. Examples of these are: `uint8_t`, `int8_t`, etc.
- Constant Qualifiers
- Read-only methods, global variables, stack variables, or data members are read-only should be qualified using the C or C++ `const` qualifier.
- Pointers or references to read-only objects or storage, including but not limited to function parameters, should be qualified using the C or C++ `const` qualifier.
- Header Include Guard
- All C and C++ headers shall use preprocessor header include guards.
- The terminating endif preprocessor directive shall have a comment, C or C++ depending on the header type, containing the preprocessor symbol introduced by the ifndef directive starting the guard.
- The symbol used for the guard should be the file name, converted to all uppercase, with any spaces (“ “) or dots (“.”) converted to underscores (“_”).
- The symbol used for the guard should be the file name, converted to all uppercase, with any spaces (“ “) or dots (“.”) converted to underscores (“\_”).
- Function and Method Prototypes
- All void functions or methods shall explicitly declare and specify the void type keyword.
- Unused parameters
- All unused parameters shall be declared as such using the `OT_UNUSED_VARIABLE` macro at the top of a function or method before all local variable declarations.
### C
@@ -84,16 +86,16 @@
### C++
- Prefer Passing Parameters by Reference to Pointer
- Unlike C, C++ offers an alternate way to alias data over and above a pointer, the reference, indicated by the & symbol. Where appropriate, the reference should be preferred to the pointer.
- Unlike C, C++ offers an alternate way to alias data over and above a pointer, the reference, indicated by the & symbol. Where appropriate, the reference should be preferred to the pointer.
- Passing Base Scalars
- Size- and call frequency-based considerations should be made when passing scalars as to whether they should be passed by value or by constant reference; however, pass-by-value should generally be preferred.
- Eliminate Unnecessary Destructors
- The creation of empty or useless destructors should be avoided. Empty or useless destructors should be removed.
- The creation of empty or useless destructors should be avoided. Empty or useless destructors should be removed.
- Default Parameters
- When you declare C++ free functions and object methods, you should avoid or minimize using default parameters.
- When you declare C++ virtual object methods, you shall avoid using default parameters.
- Global and Scoped Static Construction
- There shall be no use of global, static or otherwise, object construction. The use of scoped static object construction should be avoided.
- There shall be no use of global, static or otherwise, object construction. The use of scoped static object construction should be avoided.
- C++-style Casts
- Wherever possible and practical, C++ style casts should be used and preferred to the C style cast equivalent.
- Avoid `using namespace` Statements in Headers
@@ -112,24 +114,25 @@
## Format and Style
- OpenThread uses the `make pretty` build target to reformat code and enforce code format and style. The `make pretty-check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged.
- 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.
- The `make pretty` and `make pretty-check` build targets require [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1).
- `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
- File names should match the names and types of what is described in the file. If a file contains many declarations and definitions, the author should choose the one that predominantly describes or that makes the most sense.
- File names should match the names and types of what is described in the file. If a file contains many declarations and definitions, the author should choose the one that predominantly describes or that makes the most sense.
- File contents and names should be limited in the scope of what they contain. It may also be possible that there is too much stuff in one file and you need to break it up into multiple files.
- File names should be all lower case.
- File extensions shall be indicative and appropriate for the type and usage of the source or header file.
### Naming
- Names should be descriptive but not overly so and they should give some idea of scope and should be selected such that *wrong code looks wrong*.
- Names should be descriptive but not overly so and they should give some idea of scope and should be selected such that _wrong code looks wrong_.
- Names shall not give any idea of type, such as is done with System Hungarian notation.
- Case
- C preprocessor symbols should be all uppercase.
- All OpenThread names in the C language shall be in *snake case*.
- All OpenThread class, namespace, structure, method, function, enumeration, and type names in the C++ language shall be in *upper camel case*. Exception: the top level OpenThread namespace 'ot'.
- All OpenThread instantiated names of instances of classes, namespaces, structures, methods, functions, enumerations, and types as well as method and function parameters in the C++ language shall be in *lower camel case*.
- All OpenThread class, namespace, structure, method, function, enumeration, and type names in the C/C++ language shall be in _upper camel case_. Exception: the top level OpenThread namespace 'ot'.
- All OpenThread instantiated names of instances of classes, namespaces, structures, methods, functions, enumerations, and types as well as method and function parameters in the C++ language shall be in _lower camel case_.
- Symbol Qualification
- All OpenThread C public data types and free functions should have `ot` prepended to their name.
- All OpenThread C++ code should be in the ot top-level namespace.
@@ -141,6 +144,7 @@
- All variables that do not have such prefixes shall be assumed to be function local scope.
### White Space
- Indentation shall be 4 space characters.
- Conditionals shall always appear on a separate line from the code to execute as a result of the condition.
- Scoped Variable declarations
@@ -172,16 +176,24 @@
- 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
- OpenThread uses and enforces both Python 2 and Python 3. Support for Python 2 is a result of the fact that some current Linux distributions and Macs are still using 2.x as default.
- OpenThread uses and enforces Python 3.
## Conventions and Best Practices
- Run `pylint` over your code. `pylint` is a tool for finding bugs and style problems in Python source code. It finds problems that are typically caught by a compiler for less dynamic languages like C and C++. Because of the dynamic nature of Python, some warnings may be incorrect; however, spurious warnings should be fairly infrequent.
- Run `pylint` over your code. `pylint` is a tool for finding bugs and style problems in Python source code. It finds problems that are typically caught by a compiler for less dynamic languages like C and C++. Because of the dynamic nature of Python, some warnings may be incorrect; however, spurious warnings should be fairly infrequent.
## Format and Style
- All code should adhere to [PEP 8](https://www.python.org/dev/peps/pep-0008/).
- All code should adhere to [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) except maximum line length being 119.
+7 -7
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
@@ -36,10 +36,10 @@
nlbuild_autotools_stem="third_party/nlbuild-autotools/repo"
# Establish some key directories
abs_srcdir=$(cd "$(dirname "${0}")" && pwd)
srcdir=`dirname ${0}`
abs_srcdir=`pwd`
abs_top_srcdir="${abs_srcdir}"
exec ${srcdir}/${nlbuild_autotools_stem}/scripts/bootstrap -I "${abs_top_srcdir}/${nlbuild_autotools_stem}" $*
# filter out knowning information from stderr which is causing GitHub annotation check warnings.
(cd "$abs_srcdir" && exec "$abs_srcdir/$nlbuild_autotools_stem/scripts/bootstrap" -I "$abs_srcdir/$nlbuild_autotools_stem" "${@}") 2> \
>(grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/missing'" \
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/compile'" \
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/depcomp'" 1>&2)
+320 -879
View File
File diff suppressed because it is too large Load Diff
+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()
+10 -6
View File
@@ -34,18 +34,19 @@ EXTRA_DIST = \
$(srcdir)/images/Open-Thread-Logo-200x42.png \
$(srcdir)/images/openthread_logo.png \
$(srcdir)/images/ot-contrib-arm.png \
$(srcdir)/images/ot-contrib-at.png \
$(srcdir)/images/ot-contrib-dialog.png \
$(srcdir)/images/ot-contrib-ms.png \
$(srcdir)/images/ot-contrib-nest.png \
$(srcdir)/images/ot-contrib-cascoda.png \
$(srcdir)/images/ot-contrib-google.png \
$(srcdir)/images/ot-contrib-nordic.png \
$(srcdir)/images/ot-contrib-nxp.png \
$(srcdir)/images/ot-contrib-qc.png \
$(srcdir)/images/ot-contrib-qorvo.png \
$(srcdir)/images/ot-contrib-samsung.png \
$(srcdir)/images/ot-contrib-silabs.png \
$(srcdir)/images/ot-contrib-stm.png \
$(srcdir)/images/ot-contrib-synopsys.png \
$(srcdir)/images/ot-contrib-ti.png \
draft-rquattle-spinel-unified.html \
draft-rquattle-spinel-unified.txt \
$(srcdir)/images/ot-contrib-zephyr.png \
$(srcdir)/ot_api_doc.h \
$(NULL)
#
@@ -76,6 +77,9 @@ CLEANFILES = \
if OPENTHREAD_BUILD_DOCS
openthreaddir = $(includedir)/openthread
dist_openthread_HEADERS = ot_api_doc.h
all-local: html/index.html
#
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

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: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

+183
View File
@@ -0,0 +1,183 @@
/*
* 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.
*/
/**
* @file
* @brief
* This file defines the Doxygen group structure for OpenThread documentation.
*/
/**
* @defgroup api API
* @brief
* This module includes the application programming interface to the OpenThread stack.
*
* @{
*
* @defgroup api-error Error
*
* @defgroup api-execution Execution
*
* @{
*
* @defgroup api-instance Instance
* @defgroup api-tasklets Tasklets
*
* @}
*
* @defgroup api-net IPv6 Networking
* @{
*
* @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
*
* @{
*
* @defgroup api-udp UDP
* @defgroup api-udp-forward UDP Forward
*
* @}
*
* @}
*
* @defgroup api-link Link
*
* @{
*
* @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
*
* @{
*
* @defgroup api-backbone-router Backbone Router
* @defgroup api-border-agent Border Agent
* @defgroup api-border-router Border Router
* @defgroup api-commissioner Commissioner
* @defgroup api-thread-general General
* @brief This module includes functions for all Thread roles.
* @defgroup api-joiner Joiner
* @defgroup api-operational-dataset Operational Dataset
* @defgroup api-thread-router Router/Leader
* @brief This module includes functions for Thread Routers and Leaders.
* @defgroup api-server Server
*
* @}
*
* @defgroup api-addons Add-Ons
*
* @{
*
* @defgroup api-channel-manager Channel Manager
* @defgroup api-channel-monitor Channel Monitoring
* @defgroup api-child-supervision Child Supervision
* @defgroup api-coap-group CoAP
*
* @{
*
* @defgroup api-coap CoAP
* @defgroup api-coap-secure CoAP Secure
*
* @}
*
* @defgroup api-cli Command Line Interface
* @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 - Thread Stack
* @defgroup api-ncp Network Co-Processor
* @defgroup api-network-time Network Time Synchronization
* @defgroup api-random-group Random Number Generator
*
* @{
*
* @defgroup api-random-crypto RNG Cryptographic
* @defgroup api-random-non-crypto RNG Non-cryptographic
*
* @}
*
* @defgroup api-sntp SNTP
*
* @}
*
* @}
*
*/
/**
* @defgroup platform Platform Abstraction
* @brief
* This module includes the platform abstraction used by the OpenThread stack.
*
* @{
*
* @defgroup plat-alarm Alarm
* @defgroup plat-crypto Crypto - Platform
* @defgroup plat-entropy Entropy
* @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
* @defgroup plat-otns Network Simulator
* @defgroup plat-radio Radio
* @defgroup plat-settings Settings
* @defgroup plat-spi-slave SPI Slave
* @defgroup plat-time Time Service
* @defgroup plat-toolchain Toolchain
* @defgroup plat-trel TREL - Platform
*
* @}
*
*/
-114
View File
@@ -1,114 +0,0 @@
#
# Copyright (c) 2016, Nest Labs, Inc.
# 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.
#
XML2RFC_CACHE_DIR ?= $(HOME)/.cache/xml2rfc
TOOL_PREFIX = $(DOCKER) run --rm --user=`id -u`:`id -g` -v `pwd`:/rfc -v $(XML2RFC_CACHE_DIR):/var/cache/xml2rfc paulej/rfctools
DOCKER ?= docker
MD2RFC ?= $(TOOL_PREFIX) md2rfc
XML2RFC ?= $(TOOL_PREFIX) xml2rfc
MMARK ?= $(TOOL_PREFIX) mmark
SED ?= sed
RM_F ?= rm -f
MKDIR_P ?= mkdir -p
SOURCE_DATE := $(shell (TZ=UTC git log -n 1 --date=iso-strict-local --pretty=format:%ad 2> /dev/null || date -u +"%Y-%m-%dT%H:%M:%SZ" ) | sed 's/+00:00$$/Z/')
SOURCE_VERSION ?= $(shell git describe --dirty --always --match "--PoIsOn--" 2> /dev/null)
# -------------
SRC := $(wildcard draft-*.md) $(wildcard draft-*.md.in)
XML := $(patsubst %.md,%.xml,$(patsubst %.md.in,%.xml,$(SRC)))
TXT := $(patsubst %.md,%.txt,$(patsubst %.md.in,%.txt,$(SRC)))
HTML := $(patsubst %.md,%.html,$(patsubst %.md.in,%.html,$(SRC)))
all: $(XML) $(TXT) $(HTML)
clean:
$(RM_F) $(XML) $(TXT) $(HTML) $(patsubst %.md.in,%.md,$(wildcard draft-*.md.in))
$(XML2RFC_CACHE_DIR):
$(MKDIR_P) "$(XML2RFC_CACHE_DIR)"
%.md: %.md.in
$(SED) 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/g;s/@SOURCE_DATE@/$(SOURCE_DATE)/g' < $< > $@
%.xml: %.md
$(MMARK) -xml2 -page $< $@
$(SED) -i "" -e 's/fullname="James Woodyatt"/fullname="James Woodyatt" role="editor"/' $@
%.html: %.xml $(XML2RFC_CACHE_DIR)
$(XML2RFC) --html $<
%.txt: %.xml $(XML2RFC_CACHE_DIR)
$(XML2RFC) --text $<
# -------------
draft-rquattle-spinel-basis.xml: \
draft-rquattle-spinel-basis.md \
spinel-commands.md \
spinel-data-packing.md \
spinel-example-sessions.md \
spinel-feature-host-buffer-offload.md \
spinel-feature-network-save.md \
spinel-frame-format.md \
spinel-framing.md \
spinel-prop-core.md \
spinel-prop-debug.md \
spinel-prop-ipv6.md \
spinel-prop-mac.md \
spinel-prop-net.md \
spinel-prop-phy.md \
spinel-prop.md \
spinel-status-codes.md \
spinel-tech-thread.md \
spinel-test-vectors.md \
$(NULL)
draft-rquattle-spinel-unified.xml: \
draft-rquattle-spinel-unified.md \
spinel-commands.md \
spinel-data-packing.md \
spinel-example-sessions.md \
spinel-feature-host-buffer-offload.md \
spinel-feature-network-save.md \
spinel-frame-format.md \
spinel-framing.md \
spinel-prop-core.md \
spinel-prop-debug.md \
spinel-prop-ipv6.md \
spinel-prop-mac.md \
spinel-prop-net.md \
spinel-prop-phy.md \
spinel-prop.md \
spinel-status-codes.md \
spinel-tech-thread.md \
spinel-test-vectors.md \
$(NULL)
@@ -1,109 +0,0 @@
%%%
title = "Spinel: A protocol basis for control and management of IPv6 network interface co-processors"
abbrev = "Spinel Basis"
category = "std"
docName = "draft-rquattle-spinel-basis"
ipr = "trust200902"
keyword = ["Spinel", "IPv6", "NCP"]
date = @SOURCE_DATE@
[pi]
editing = "yes"
compact = "yes"
subcompact = "yes"
comments = "yes"
[[author]]
initials = "R."
surname = "Quattlebaum"
fullname = "Robert S. Quattlebaum"
organization = "Nest Labs, Inc."
[author.address]
email = "rquattle@nestlabs.com"
[author.address.postal]
street = "3400 Hillview Ave."
city = "Palo Alto"
region = "California"
code = "94304"
country = "USA"
[[author]]
initials = "j.h."
surname = "woodyatt"
fullname = "james woodyatt"
organization = "Nest Labs, Inc."
role = "editor"
[author.address]
email = "jhw@nestlabs.com"
[author.address.postal]
street = "3400 Hillview Ave."
city = "Palo Alto"
region = "California"
code = "94304"
country = "USA"
%%%
.# Abstract
This document specifies the basis of the Spinel protocol, which facilitates the control and management of IPv6 network interfaces on devices where general purpose application processors offload network functions at their interfaces to network co-processors (NCP) connected by simple communication links like serial data channels. Spinel was initially designed for use with Thread network co-processors, but its basis is general purpose and intended to be easily adapted to other types of IPv6 network interface.
{mainmatter}
# Introduction #
Spinel is a host-controller protocol designed to enable interoperation over simple serial connections between general purpose device operating systems (OS) and network co-processors (NCP) for the purpose of controlling and managing their IPv6 network interfaces, achieving the following goals:
* Adopt a layered approach to the protocol design, allowing future support for other types of IPv6 link.
* Minimize the number of required commands/methods by supporting a rich, property-based programming interface.
* Support NCPs capable of multiple simultaneous IPv6 interfaces.
* Support NCPs capable of communicating simultaneously on more than one physical link.
* Gracefully handle the addition of new features and capabilities without necessarily breaking backward compatibility.
* Be as minimal and light-weight as possible without unnecessarily sacrificing flexibility.
On top of this core framework, properties and commands enable various common features of IPv6. In related and forthcoming documents, the Spinel protocol is extended to support NCP implementations for specific IPv6 link types, e.g. Thread.
{{spinel-frame-format.md}}
{{spinel-data-packing.md}}
{{spinel-commands.md}}
{{spinel-prop.md}}
{{spinel-status-codes.md}}
{{spinel-tech-thread.md}}
{{spinel-feature-network-save.md}}
{{spinel-feature-host-buffer-offload.md}}
{{spinel-feature-jam-detect.md}}
{{spinel-feature-gpio.md}}
{{spinel-feature-trng.md}}
{{spinel-security-considerations.md}}
{backmatter}
{{spinel-framing.md}}
{{spinel-test-vectors.md}}
{{spinel-example-sessions.md}}
{{spinel-basis-glossary.md}}
# Acknowledgments #
Thread is a registered trademark of The Thread Group, Inc.
Special thanks to Nick Banks, Jonathan Hui, Abtin Keshavarzian, Piotr Szkotak, Arjuna Sivasithambaresan and Martin Turon for their substantial contributions and feedback related to this document.
This document was prepared using [mmark](https://github.com/miekg/mmark) by (Miek Gieben) and [xml2rfc (version 2)](http://xml2rfc.ietf.org/).
@@ -1,174 +0,0 @@
%%%
title = "Spinel Host-Controller Protocol"
abbrev = "Spinel Protocol (Unified)"
category = "info"
docName = "draft-rquattle-spinel-unified-@SOURCE_VERSION@"
ipr = "noDerivativesTrust200902"
keyword = ["Spinel", "IPv6", "NCP"]
date = @SOURCE_DATE@
submissionType = "independent"
[pi]
editing = "yes"
compact = "yes"
subcompact = "yes"
comments = "yes"
[[author]]
initials = "R."
surname = "Quattlebaum"
fullname = "Robert S. Quattlebaum"
organization = "Nest Labs, Inc."
[author.address]
email = "rquattle@nestlabs.com"
[author.address.postal]
street = "3400 Hillview Ave."
city = "Palo Alto"
region = "California"
code = "94304"
country = "USA"
[[author]]
role = "editor"
initials = "J.H."
surname = "Woodyatt"
fullname = "James Woodyatt"
organization = "Nest Labs, Inc."
[author.address]
email = "jhw@nestlabs.com"
[author.address.postal]
street = "3400 Hillview Ave."
city = "Palo Alto"
region = "California"
code = "94304"
country = "USA"
%%%
.# Abstract
This document describes the Spinel protocol, which facilitates the control and
management of IPv6 network interfaces on devices where general purpose
application processors offload network functions at their interfaces to network
co-processors (NCP) connected by simple communication links like serial data
channels. While initially developed to support Thread(R), Spinel's layered
design allows it to be easily adapted to other similar network technologies.
This document also describes various Spinel specializations, including support
for the Thread(R) low-power mesh network technology.
{mainmatter}
# Introduction #
Spinel is a host-controller protocol designed to enable interoperation over simple serial connections between general purpose device operating systems (OS) and network co-processors (NCP) for the purpose of controlling and managing their IPv6 network interfaces, achieving the following goals:
* Adopt a layered approach to the protocol design, allowing future
support for other network protocols.
* Minimize the number of required commands/methods by providing a
rich, property-based API.
* Support NCPs capable of being connected to more than one network
at a time.
* Gracefully handle the addition of new features and capabilities
without necessarily breaking backward compatibility.
* Be as minimal and light-weight as possible without unnecessarily
sacrificing flexibility.
On top of this core framework, we define the properties and commands
to enable various features and network protocols.
## About this Draft ##
This document is currently in a draft status and is changing often.
This section discusses some ideas for changes to the protocol that
haven't yet been fully specified, as well as some of the impetus for
the current design.
### Scope ###
The eventual intent is to have two documents: A Spinel basis document
which discusses the network-technology-agnostic mechanisms and a
Thread(R) specialization document which describes all of the Thread(R)-specific
implementation details. Currently, this document covers both.
### Renumbering ###
Efforts are currently maintained to try to prevent overtly
backward-incompatible changes to the existing protocol, but if you are
implementing Spinel in your own products you should expect there to be
at least one large renumbering event and major version number change
before the standard is considered "baked". All changes will be clearly
marked and documented to make such a transition as easy as possible.
To allow conclusive detection of protocol (in)compatibility between
the host and the NCP, the following commands and properties are
already considered to be "baked" and will not change:
* Command IDs zero through eight. (Reset, No-op, and Property-Value
Commands)
* Property IDs zero through two. (Last status, Protocol Version, and
NCP Version)
Renumbering would be undertaken in order to better organize the
allocation of property IDs and capability IDs. One of the initial
goals of this protocol was for it to be possible for a host or NCP to
only implement properties with values less than 127 and for the NCP to
still be usable---relegating all larger property values for extra
features or other capabilities that aren't strictly necessary. This
would allow simple implementations to avoid the need to implement
support for PUIs ((#packed-unsigned-integer)).
As time has gone by and the protocol has become more fleshed out, it
has become clear that some of the initial allocations were inadequate
and should be revisited if we want to try to achieve the original
goal.
{{spinel-frame-format.md}}
{{spinel-data-packing.md}}
{{spinel-commands.md}}
{{spinel-prop.md}}
{{spinel-status-codes.md}}
{{spinel-tech-thread.md}}
{{spinel-feature-network-save.md}}
{{spinel-feature-host-buffer-offload.md}}
{{spinel-feature-jam-detect.md}}
{{spinel-feature-gpio.md}}
{{spinel-feature-trng.md}}
{{spinel-security-considerations.md}}
{backmatter}
{{spinel-framing.md}}
{{spinel-test-vectors.md}}
{{spinel-example-sessions.md}}
{{spinel-basis-glossary.md}}
# Acknowledgments #
Thread is a registered trademark of The Thread Group, Inc.
Special thanks to Nick Banks, Jonathan Hui, Abtin Keshavarzian, Yakun Xu,
Piotr Szkotak, Arjuna Sivasithambaresan and Martin Turon for their
substantial contributions and feedback related to this document.
This document was prepared using [mmark](https://github.com/miekg/mmark)
by (Miek Gieben) and [xml2rfc (version 2)](http://xml2rfc.ietf.org/).
@@ -1,25 +0,0 @@
# Glossary #
<!-- RQ -- Alphabetize before finalization. -->
FCS
: Final Checksum. Bytes added to the end of a packet to help determine if the packet was received without corruption.
NCP
: Network Control Processor.
NLI
: Network Link Identifier. May be a value between zero and three. See (#nli-network-link-identifier) for more information.
OS
: Operating System, i.e. the IPv6 node using Spinel to control and manage one or more of its IPv6 network interfaces.
PHY
: Physical layer. Refers to characteristics and parameters related to the physical implementation and operation of a networking medium.
PUI
: Packed Unsigned Integer. A way to serialize an unsigned integer using one, two, or three bytes. Used throughout the Spinel protocol. See (#packed-unsigned-integer) for more information.
TID
: Transaction Identifier. May be a value between zero and fifteen. See (#tid-transaction-identifier) for more information.
-330
View File
@@ -1,330 +0,0 @@
# Commands
## CMD 0: (Host->NCP) CMD_NOOP {#cmd-noop}
Octets: | 1 | 1
--------|--------|----------
Fields: | HEADER | CMD_NOOP
No-Operation command. Induces the NCP to send a success status back to
the host. This is primarily used for liveliness checks.
The command payload for this command SHOULD be empty. The receiver
MUST ignore any non-empty command payload.
There is no error condition for this command.
## CMD 1: (Host->NCP) CMD_RESET {#cmd-reset}
Octets: | 1 | 1
--------|--------|----------
Fields: | HEADER | CMD_RESET
Reset NCP command. Causes the NCP to perform a software reset. Due to
the nature of this command, the TID is ignored. The host should
instead wait for a `CMD_PROP_VALUE_IS` command from the NCP indicating
`PROP_LAST_STATUS` has been set to `STATUS_RESET_SOFTWARE`.
The command payload for this command SHOULD be empty. The receiver
MUST ignore any non-empty command payload.
If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
instead with the value set to the generated status code for the error.
## CMD 2: (Host->NCP) CMD_PROP_VALUE_GET {#cmd-prop-value-get}
Octets: | 1 | 1 | 1-3
--------|--------|--------------------|---------
Fields: | HEADER | CMD_PROP_VALUE_GET | PROP_ID
Get property value command. Causes the NCP to emit a
`CMD_PROP_VALUE_IS` command for the given property identifier.
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer).
If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
instead with the value set to the generated status code for the error.
## CMD 3: (Host->NCP) CMD_PROP_VALUE_SET {#cmd-prop-value-set}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|--------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_SET | PROP_ID | VALUE
Set property value command. Instructs the NCP to set the given
property to the specific given value, replacing any previous value.
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the property value. The exact format of the property value is defined
by the property.
If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
with the value set to the generated status code for the error.
## CMD 4: (Host->NCP) CMD_PROP_VALUE_INSERT {#cmd-prop-value-insert}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|-----------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_INSERT | PROP_ID | VALUE
Insert value into property command. Instructs the NCP to insert the
given value into a list-oriented property, without removing other
items in the list. The resulting order of items in the list is defined
by the individual property being operated on.
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the value to be inserted. The exact format of the value is defined by
the property.
If the type signature of the property specified by `PROP_ID` consists
of a single structure enclosed by an array (`A(t(...))`), then the
contents of `VALUE` MUST contain the contents of the structure (`...`)
rather than the serialization of the whole item (`t(...)`). Specifically,
the length of the structure MUST NOT be prepended to `VALUE`. This
helps to eliminate redundant data.
If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
with the value set to the generated status code for the error.
## CMD 5: (Host->NCP) CMD_PROP_VALUE_REMOVE {#cmd-prop-value-remove}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|-----------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_REMOVE | PROP_ID | VALUE
Remove value from property command. Instructs the NCP to remove the
given value from a list-oriented property, without affecting other
items in the list. The resulting order of items in the list is defined
by the individual property being operated on.
Note that this command operates *by value*, not by index!
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the value to be removed. The exact format of the value is defined by
the property.
If the type signature of the property specified by `PROP_ID` consists
of a single structure enclosed by an array (`A(t(...))`), then the
contents of `VALUE` MUST contain the contents of the structure (`...`)
rather than the serialization of the whole item (`t(...)`). Specifically,
the length of the structure MUST NOT be prepended to `VALUE`. This
helps to eliminate redundant data.
If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
with the value set to the generated status code for the error.
## CMD 6: (NCP->Host) CMD_PROP_VALUE_IS {#cmd-prop-value-is}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|-------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_IS | PROP_ID | VALUE
Property value notification command. This command can be sent by the
NCP in response to a previous command from the host, or it can be sent
by the NCP in an unsolicited fashion to notify the host of various
state changes asynchronously.
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the current value of the given property.
## CMD 7: (NCP->Host) CMD_PROP_VALUE_INSERTED {#cmd-prop-value-inserted}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|-------------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_INSERTED | PROP_ID | VALUE
Property value insertion notification command. This command can be
sent by the NCP in response to the `CMD_PROP_VALUE_INSERT` command, or
it can be sent by the NCP in an unsolicited fashion to notify the host
of various state changes asynchronously.
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the value that was inserted into the given property.
If the type signature of the property specified by `PROP_ID` consists
of a single structure enclosed by an array (`A(t(...))`), then the
contents of `VALUE` MUST contain the contents of the structure (`...`)
rather than the serialization of the whole item (`t(...)`). Specifically,
the length of the structure MUST NOT be prepended to `VALUE`. This
helps to eliminate redundant data.
The resulting order of items in the list is defined by the given
property.
## CMD 8: (NCP->Host) CMD_PROP_VALUE_REMOVED {#cmd-prop-value-removed}
Octets: | 1 | 1 | 1-3 | *n*
--------|--------|------------------------|---------|------------
Fields: | HEADER | CMD_PROP_VALUE_REMOVED | PROP_ID | VALUE
Property value removal notification command. This command can be sent
by the NCP in response to the `CMD_PROP_VALUE_REMOVE` command, or it
can be sent by the NCP in an unsolicited fashion to notify the host of
various state changes asynchronously.
Note that this command operates *by value*, not by index!
The payload for this command is the property identifier encoded in the
packed unsigned integer format described in (#packed-unsigned-integer), followed by
the value that was removed from the given property.
If the type signature of the property specified by `PROP_ID` consists
of a single structure enclosed by an array (`A(t(...))`), then the
contents of `VALUE` MUST contain the contents of the structure (`...`)
rather than the serialization of the whole item (`t(...)`). Specifically,
the length of the structure MUST NOT be prepended to `VALUE`. This
helps to eliminate redundant data.
The resulting order of items in the list is defined by the given
property.
## CMD 18: (Host->NCP) CMD_PEEK {#cmd-peek}
Octets: | 1 | 1 | 4 | 2
--------|--------|----------|---------|-------
Fields: | HEADER | CMD_PEEK | ADDRESS | COUNT
This command allows the NCP to fetch values from the RAM of the NCP
for debugging purposes. Upon success, `CMD_PEEK_RET` is sent from the
NCP to the host. Upon failure, `PROP_LAST_STATUS` is emitted with
the appropriate error indication.
Due to the low-level nature of this command, certain error conditions
may induce the NCP to reset.
The NCP MAY prevent certain regions of memory from being accessed.
The implementation of this command has security implications.
See (#security-considerations) for more information.
This command requires the capability `CAP_PEEK_POKE` to be present.
## CMD 19: (NCP->Host) CMD_PEEK_RET {#cmd-peek-ret}
Octets: | 1 | 1 | 4 | 2 | *n*
--------|--------|--------------|---------|-------|-------
Fields: | HEADER | CMD_PEEK_RET | ADDRESS | COUNT | BYTES
This command contains the contents of memory that was requested by
a previous call to `CMD_PEEK`.
This command requires the capability `CAP_PEEK_POKE` to be present.
## CMD 20: (Host->NCP) CMD_POKE {#cmd-poke}
Octets: | 1 | 1 | 4 | 2 | *n*
--------|--------|----------|---------|-------|-------
Fields: | HEADER | CMD_POKE | ADDRESS | COUNT | BYTES
This command writes the bytes to the specified memory address
for debugging purposes.
Due to the low-level nature of this command, certain error conditions
may induce the NCP to reset.
The implementation of this command has security implications.
See (#security-considerations) for more information.
This command requires the capability `CAP_PEEK_POKE` to be present.
## CMD 21: (Host->NCP) CMD_PROP_VALUE_MULTI_GET {#cmd-prop-value-multi-get}
* Argument-Encoding: `A(i)`
* Required Capability: `CAP_CMD_MULTI`
Fetch the value of multiple properties in one command. Arguments are
an array of property IDs. If all properties are fetched successfully,
a `CMD_PROP_VALUES_ARE` command is sent back to the host containing
the propertyid and value of each fetched property. The order of the
results in `CMD_PROP_VALUES_ARE` match the order of properties given
in `CMD_PROP_VALUE_GET`.
Errors fetching individual properties are reflected as indicating a
change to `PROP_LAST_STATUS` for that property's place.
Not all properties can be fetched using this method. As a general rule
of thumb, any property that blocks when getting will fail for that
individual property with `STATUS_INVALID_COMMAND_FOR_PROP`.
## CMD 22: (Host->NCP) CMD_PROP_VALUE_MULTI_SET {#cmd-prop-value-multi-set}
* Argument-Encoding: `A(iD)`
* Required Capability: `CAP_CMD_MULTI`
Octets: | 1 | 1 | *n*
--------|--------|--------------------------|----------------------
Fields: | HEADER | CMD_PROP_VALUE_MULTI_SET | Property/Value Pairs
With each property/value pair being:
Octets: | 2 | 1-3 | *n*
--------|--------|---------|------------
Fields: | LENGTH | PROP_ID | PROP_VALUE
This command sets the value of several properties at once in the given
order. The setting of properties stops at the first error, ignoring
any later properties.
The result of this command is generally `CMD_PROP_VALUES_ARE` unless
(for example) a parsing error has occured (in which case
`CMD_PROP_VALUE_IS` for `PROP_LAST_STATUS` would be the result). The
order of the results in `CMD_PROP_VALUES_ARE` match the order of
properties given in `CMD_PROP_VALUE_MULTI_SET`.
Since the processing of properties to set stops at the first error,
the resulting `CMD_PROP_VALUES_ARE` can contain fewer items than the
requested number of properties to set.
Not all properties can be set using this method. As a general rule
of thumb, any property that blocks when setting will fail for that
individual property with `STATUS_INVALID_COMMAND_FOR_PROP`.
## CMD 23: (NCP->Host) CMD_PROP_VALUES_ARE {#cmd-prop-values-are}
* Argument-Encoding: `A(iD)`
* Required Capability: `CAP_CMD_MULTI`
Octets: | 1 | 1 | *n*
--------|--------|---------------------|----------------------
Fields: | HEADER | CMD_PROP_VALUES_ARE | Property/Value Pairs
With each property/value pair being:
Octets: | 2 | 1-3 | *n*
--------|--------|---------|------------
Fields: | LENGTH | PROP_ID | PROP_VALUE
This command is emitted by the NCP as the response to both the
`CMD_PROP_VALUE_MULTI_GET` and `CMD_PROP_VALUE_MULTI_SET` commands. It
is roughly analogous to `CMD_PROP_VALUE_IS`, except that it contains
more than one property.
This command SHOULD NOT be emitted asynchronously, or in response to
any command other than `CMD_PROP_VALUE_MULTI_GET` or
`CMD_PROP_VALUE_MULTI_SET`.
The arguments are a list of structures containing the emitted property
and the associated value. These are presented in the same order as
given in the associated initiating command. In cases where getting or
setting a specific property resulted in an error, the associated slot
in this command will describe `PROP_LAST_STATUS`.
@@ -1,169 +0,0 @@
# Data Packing
Data serialization for properties is performed using a light-weight
data packing format which was loosely inspired by D-Bus. The format of
a serialization is defined by a specially formatted string.
This packing format is used for notational convenience. While this
string-based datatype format has been designed so that the strings may
be directly used by a structured data parser, such a thing is not
required to implement Spinel. Indeed, higly constrained applications
may find such a thing to be too heavyweight.
Goals:
* Be lightweight and favor direct representation of values.
* Use an easily readable and memorable format string.
* Support lists and structures.
* Allow properties to be appended to structures while maintaining
backward compatibility.
Each primitive datatype has an ASCII character associated with it.
Structures can be represented as strings of these characters. For
example:
* `C`: A single unsigned byte.
* `C6U`: A single unsigned byte, followed by a 128-bit IPv6
address, followed by a zero-terminated UTF8 string.
* `A(6)`: An array of concatenated IPv6 addresses
In each case, the data is represented exactly as described. For
example, an array of 10 IPv6 address is stored as 160 bytes.
## Primitive Types
Char | Name | Description
-----|:--------------------|:------------------------------
`.` | DATATYPE_VOID | Empty data type. Used internally.
`b` | DATATYPE_BOOL | Boolean value. Encoded in 8-bits as either 0x00 or 0x01. All other values are illegal.
`C` | DATATYPE_UINT8 | Unsigned 8-bit integer.
`c` | DATATYPE_INT8 | Signed 8-bit integer.
`S` | DATATYPE_UINT16 | Unsigned 16-bit integer.
`s` | DATATYPE_INT16 | Signed 16-bit integer.
`L` | DATATYPE_UINT32 | Unsigned 32-bit integer.
`l` | DATATYPE_INT32 | Signed 32-bit integer.
`X` | DATATYPE_UINT64 | Unsigned 64-bit integer.
`x` | DATATYPE_INT64 | Signed 64-bit integer.
`i` | DATATYPE_UINT_PACKED | Packed Unsigned Integer. See (#packed-unsigned-integer).
`6` | DATATYPE_IPv6ADDR | IPv6 Address. (Big-endian)
`E` | DATATYPE_EUI64 | EUI-64 Address. (Big-endian)
`e` | DATATYPE_EUI48 | EUI-48 Address. (Big-endian)
`D` | DATATYPE_DATA | Arbitrary data. See (#data-blobs).
`d` | DATATYPE_DATA_WLEN | Arbitrary data with prepended length. See (#data-blobs).
`U` | DATATYPE_UTF8 | Zero-terminated UTF8-encoded string.
`t(...)` | DATATYPE_STRUCT | Structured datatype with prepended length. See (#structured-data).
`A(...)` | DATATYPE_ARRAY | Array of datatypes. Compound type. See (#arrays).
All multi-byte values are little-endian unless explicitly stated
otherwise.
## Packed Unsigned Integer
For certain types of integers, such command or property identifiers,
usually have a value on the wire that is less than 127. However, in
order to not preclude the use of values larger than 255, we would need
to add an extra byte. Doing this would add an extra byte to the
majority of instances, which can add up in terms of bandwidth.
The packed unsigned integer format is based on the [unsigned integer
format in EXI][EXI], except that we limit the maximum value to the
largest value that can be encoded into three bytes(2,097,151).
[EXI]: https://www.w3.org/TR/exi/#encodingUnsignedInteger
For all values less than 127, the packed form of the number is simply
a single byte which directly represents the number. For values larger
than 127, the following process is used to encode the value:
1. The unsigned integer is broken up into *n* 7-bit chunks and placed
into *n* octets, leaving the most significant bit of each octet
unused.
2. Order the octets from least-significant to most-significant.
(Little-endian)
3. Clear the most significant bit of the most significant octet. Set
the least significant bit on all other octets.
Where *n* is the smallest number of 7-bit chunks you can use to
represent the given value.
Take the value 1337, for example:
1337 => 0x0539
=> [39 0A]
=> [B9 0A]
To decode the value, you collect the 7-bit chunks until you find an
octet with the most significant bit clear.
## Data Blobs
There are two types for data blobs: `d` and `D`.
* `d` has the length of the data (in bytes) prepended to the data
(with the length encoded as type `S`). The size of the length
field is not included in the length.
* `D` does not have a prepended length: the length of the data is
implied by the bytes remaining to be parsed. It is an error for
`D` to not be the last type in a type in a type signature.
This dichotomy allows for more efficient encoding by eliminating
redundency. If the rest of the buffer is a data blob, encoding the
length would be redundant because we already know how many bytes are
in the rest of the buffer.
In some cases we use `d` even if it is the last field in a type signature.
We do this to allow for us to be able to append additional fields
to the type signature if necessary in the future. This is usually the
case with embedded structs, like in the scan results.
For example, let's say we have a buffer that is encoded with the
datatype signature of `CLLD`. In this case, it is pretty easy to tell
where the start and end of the data blob is: the start is 9 bytes from
the start of the buffer, and its length is the length of the buffer
minus 9. (9 is the number of bytes taken up by a byte and two longs)
The datatype signature `CLLDU` is illegal because we can't determine
where the last field (a zero-terminated UTF8 string) starts. But the
datatype `CLLdU` *is* legal, because the parser can determine the
exact length of the data blob-- allowing it to know where the start
of the next field would be.
## Structured Data
The structure data type (`t(...)`) is a way of bundling together
several fields into a single structure. It can be thought of as a
`d` type except that instead of being opaque, the fields in the
content are known. This is useful for things like scan results where
you have substructures which are defined by different layers.
For example, consider the type signature `Lt(ES)t(6C)`. In this
hypothetical case, the first struct is defined by the MAC layer, and
the second struct is defined by the PHY layer. Because of the use of
structures, we know exactly what part comes from that layer.
Additionally, we can add fields to each structure without introducing
backward compatability problems: Data encoded as `Lt(ESU)t(6C)` (Notice
the extra `U`) will
decode just fine as `Lt(ES)t(6C)`. Additionally, if we don't care
about the MAC layer and only care about the network layer, we could
parse as `Lt()t(6C)`.
Note that data encoded as `Lt(ES)t(6C)` will also parse as `Ldd`,
with the structures from both layers now being opaque data blobs.
## Arrays
An array is simply a concatenated set of *n* data encodings. For example,
the type `A(6)` is simply a list of IPv6 addresses---one after the other.
The type `A(6E)` likewise a concatenation of IPv6-address/EUI-64 pairs.
If an array contains many fields, the fields will often be surrounded
by a structure (`t(...)`). This effectively prepends each item in the
array with its length. This is useful for improving parsing performance
or to allow additional fields to be added in the future in a backward
compatible way. If there is a high certainty that additional
fields will never be added, the struct may be omitted (saving two bytes
per item).
This specification does not define a way to embed an array as a field
alongside other fields.
@@ -1,210 +0,0 @@
# Example Sessions
## NCP Initialization
<!-- RQ -- FIXME: This example session is incomplete. -->
Check the protocol version to see if it is supported:
* CMD_VALUE_GET:PROP_PROTOCOL_VERSION
* CMD_VALUE_IS:PROP_PROTOCOL_VERSION
Check the NCP version to see if a firmware update may be necessary:
* CMD_VALUE_GET:PROP_NCP_VERSION
* CMD_VALUE_IS:PROP_NCP_VERSION
Check interface type to make sure that it is what we expect:
* CMD_VALUE_GET:PROP_INTERFACE_TYPE
* CMD_VALUE_IS:PROP_INTERFACE_TYPE
If the host supports using vendor-specific commands, the vendor should
be verified before using them:
* CMD_VALUE_GET:PROP_VENDOR_ID
* CMD_VALUE_IS:PROP_VENDOR_ID
Fetch the capability list so that we know what features this NCP
supports:
* CMD_VALUE_GET:PROP_CAPS
* CMD_VALUE_IS:PROP_CAPS
If the NCP supports CAP_NET_SAVE, then we go ahead and recall the network:
* CMD_NET_RECALL
## Attaching to a network
<!-- RQ -- FIXME: This example session is incomplete. -->
We make the assumption that the NCP is not currently associated
with a network.
Set the network properties, if they were not already set:
* CMD_VALUE_SET:PROP_PHY_CHAN
* CMD_VALUE_IS:PROP_PHY_CHAN
* CMD_VALUE_SET:PROP_NET_XPANID
* CMD_VALUE_IS:PROP_NET_XPANID
* CMD_VALUE_SET:PROP_MAC_15_4_PANID
* CMD_VALUE_IS:PROP_MAC_15_4_PANID
* CMD_VALUE_SET:PROP_NET_NETWORK_NAME
* CMD_VALUE_IS:PROP_NET_NETWORK_NAME
* CMD_VALUE_SET:PROP_NET_MASTER_KEY
* CMD_VALUE_IS:PROP_NET_MASTER_KEY
* CMD_VALUE_SET:PROP_NET_KEY_SEQUENCE_COUNTER
* CMD_VALUE_IS:PROP_NET_KEY_SEQUENCE_COUNTER
* CMD_VALUE_SET:PROP_NET_KEY_SWITCH_GUARDTIME
* CMD_VALUE_IS:PROP_NET_KEY_SWITCH_GUARDTIME
Bring the network interface up:
* CMD_VALUE_SET:PROP_NET_IF_UP:TRUE
* CMD_VALUE_IS:PROP_NET_IF_UP:TRUE
Bring the routing stack up:
* CMD_VALUE_SET:PROP_NET_STACK_UP:TRUE
* CMD_VALUE_IS:PROP_NET_STACK_UP:TRUE
Some asynchronous events from the NCP:
* CMD_VALUE_IS:PROP_NET_ROLE
* CMD_VALUE_IS:PROP_NET_PARTITION_ID
* CMD_VALUE_IS:PROP_THREAD_ON_MESH_NETS
## Successfully joining a pre-existing network
<!-- RQ -- FIXME: This example session is incomplete. -->
This example session is identical to the above session up to the point
where we set PROP_NET_IF_UP to true. From there, the behavior changes.
* CMD_VALUE_SET:PROP_NET_REQUIRE_JOIN_EXISTING:TRUE
* CMD_VALUE_IS:PROP_NET_REQUIRE_JOIN_EXISTING:TRUE
Bring the routing stack up:
* CMD_VALUE_SET:PROP_NET_STACK_UP:TRUE
* CMD_VALUE_IS:PROP_NET_STACK_UP:TRUE
Some asynchronous events from the NCP:
* CMD_VALUE_IS:PROP_NET_ROLE
* CMD_VALUE_IS:PROP_NET_PARTITION_ID
* CMD_VALUE_IS:PROP_THREAD_ON_MESH_NETS
Now let's save the network settings to NVRAM:
* CMD_NET_SAVE
## Unsuccessfully joining a pre-existing network
This example session is identical to the above session up to the point
where we set PROP_NET_IF_UP to true. From there, the behavior changes.
* CMD_VALUE_SET:PROP_NET_REQUIRE_JOIN_EXISTING:TRUE
* CMD_VALUE_IS:PROP_NET_REQUIRE_JOIN_EXISTING:TRUE
Bring the routing stack up:
* CMD_VALUE_SET:PROP_NET_STACK_UP:TRUE
* CMD_VALUE_IS:PROP_NET_STACK_UP:TRUE
Some asynchronous events from the NCP:
* CMD_VALUE_IS:PROP_LAST_STATUS:STATUS_JOIN_NO_PEERS
* CMD_VALUE_IS:PROP_NET_STACK_UP:FALSE
## Detaching from a network
TBD
## Attaching to a saved network
<!-- RQ -- FIXME: This example session is incomplete. -->
Recall the saved network if you haven't already done so:
* CMD_NET_RECALL
Bring the network interface up:
* CMD_VALUE_SET:PROP_NET_IF_UP:TRUE
* CMD_VALUE_IS:PROP_NET_IF_UP:TRUE
Bring the routing stack up:
* CMD_VALUE_SET:PROP_NET_STACK_UP:TRUE
* CMD_VALUE_IS:PROP_NET_STACK_UP:TRUE
Some asynchronous events from the NCP:
* CMD_VALUE_IS:PROP_NET_ROLE
* CMD_VALUE_IS:PROP_NET_PARTITION_ID
* CMD_VALUE_IS:PROP_THREAD_ON_MESH_NETS
## NCP Software Reset
<!-- RQ -- FIXME: This example session is incomplete. -->
* CMD_RESET
* CMD_VALUE_IS:PROP_LAST_STATUS:STATUS_RESET_SOFTWARE
Then jump to (#ncp-initialization).
## Adding an on-mesh prefix
TBD
## Entering low-power modes
TBD
## Sniffing raw packets
<!-- RQ -- FIXME: This example session is incomplete. -->
This assumes that the NCP has been initialized.
Optionally set the channel:
* CMD_VALUE_SET:PROP_PHY_CHAN:x
* CMD_VALUE_IS:PROP_PHY_CHAN
Set the filter mode:
* CMD_VALUE_SET:PROP_MAC_PROMISCUOUS_MODE:MAC_PROMISCUOUS_MODE_MONITOR
* CMD_VALUE_IS:PROP_MAC_PROMISCUOUS_MODE:MAC_PROMISCUOUS_MODE_MONITOR
Enable the raw stream:
* CMD_VALUE_SET:PROP_MAC_RAW_STREAM_ENABLED:TRUE
* CMD_VALUE_IS:PROP_MAC_RAW_STREAM_ENABLED:TRUE
Enable the PHY directly:
* CMD_VALUE_SET:PROP_PHY_ENABLED:TRUE
* CMD_VALUE_IS:PROP_PHY_ENABLED:TRUE
Now we will get raw 802.15.4 packets asynchronously on
PROP_STREAM_RAW:
* CMD_VALUE_IS:PROP_STREAM_RAW:...
* CMD_VALUE_IS:PROP_STREAM_RAW:...
* CMD_VALUE_IS:PROP_STREAM_RAW:...
This mode may be entered even when associated with a network.
In that case, you should set `PROP_MAC_PROMISCUOUS_MODE` to
`MAC_PROMISCUOUS_MODE_PROMISCUOUS` or `MAC_PROMISCUOUS_MODE_NORMAL`, so that
you can avoid receiving packets from other networks or that are destined
for other nodes.
@@ -1,67 +0,0 @@
# Feature: Channel Monitoring {#feature-channel-monitor}
Channel monitoring is a feature that allows the NCP to periodically
monitor all channels to help determine the cleaner channels (channels
with less interference).
The presence of this feature can be detected by checking for the
presence of the `CAP_CHANNEL_MONITOR` capability in `PROP_CAPS`.
## Properties
### PROP 4614: SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_INTERVAL (#prop-channel-monitor-sample-interval)
* Type: Read-Only
* Packing-Encoding: `L`
If channel monitoring is enabled and active, every sample interval, a
zero-duration Energy Scan is performed, collecting a single RSSI sample
per channel. The RSSI samples are compared with a pre-specified RSSI
threshold.
### PROP 4615: SPINEL_PROP_CHANNEL_MONITOR_RSSI_THRESHOLD (#prop-channel-monitor-rssi-threshold)
* Type: Read-Only
* Packing-Encoding: `c`
This value specifies the threshold used by channel monitoring
module. Channel monitoring maintains the average rate of RSSI
samples that are above the threshold within (approximately) a
pre-specified number of samples (sample window).
### PROP 4616: SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_WINDOW (#prop-channel-monitor-sample-window)
* Type: Read-Only
* Packing-Encoding: `L`
The averaging sample window length (in units of number of channel
samples) used by channel monitoring module. Channel monitoring will
sample all channels every sample interval. It maintains the average rate
of RSSI samples that are above the RSSI threshold within (approximately)
the sample window.
### PROP 4617: SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_COUNT (#prop-channel-monitor-sample-count)
* Type: Read-Only
* Packing-Encoding: `L`
Total number of RSSI samples (per channel) taken by the channel
monitoring module since its start (since Thread network interface
was enabled).
### PROP 4618: SPINEL_PROP_CHANNEL_MONITOR_CHANNEL_OCCUPANCY (#prop-channel-monitor-channel-occupancy)
* Type: Read-Only
* Packing-Encoding: `A(t(cU))`
Data per item is:
* `C`: Channel
* `U`: Channel occupancy indicator
The channel occupancy value represents the average rate/percentage of
RSSI samples that were above RSSI threshold ("bad" RSSI samples) within
(approximately) latest sample window RSSI samples.
Max value of `0xffff` indicates all RSSI samples were above RSSI
threshold (i.e. 100% of samples were "bad").
@@ -1,114 +0,0 @@
# Feature: GPIO Access {#feature-gpio-access}
This feature allows the host to have control over some or all of the
GPIO pins on the NCP. The host can determine which GPIOs are available
by examining `PROP_GPIO_CONFIG`, described below. This API supports a
maximum of 256 individual GPIO pins.
Support for this feature can be determined by the presence of `CAP_GPIO`.
## Properties ##
### PROP 4096: PROP\_GPIO\_CONFIG ###
* Argument-Encoding: `A(t(CCU))`
* Type: Read-write (Writable only using `CMD_PROP_VALUE_INSERT`,
(#cmd-prop-value-insert))
An array of structures which contain the following fields:
* `C`: GPIO Number
* `C`: GPIO Configuration Flags
* `U`: Human-readable GPIO name
GPIOs which do not have a corresponding entry are not supported.
The configuration parameter contains the configuration flags for the
GPIO:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
|DIR|PUP|PDN|TRIGGER| RESERVED |
+---+---+---+---+---+---+---+---+
|O/D|
+---+
* `DIR`: Pin direction. Clear (0) for input, set (1) for output.
* `PUP`: Pull-up enabled flag.
* `PDN`/`O/D`: Flag meaning depends on pin direction:
* Input: Pull-down enabled.
* Output: Output is an open-drain.
* `TRIGGER`: Enumeration describing how pin changes generate
asynchronous notification commands (TBD) from the NCP to the host.
* 0: Feature disabled for this pin
* 1: Trigger on falling edge
* 2: Trigger on rising edge
* 3: Trigger on level change
* `RESERVED`: Bits reserved for future use. Always cleared to zero
and ignored when read.
As an optional feature, the configuration of individual pins may be
modified using the `CMD_PROP_VALUE_INSERT` command. Only the GPIO
number and flags fields MUST be present, the GPIO name (if present)
would be ignored. This command can only be used to modify the
configuration of GPIOs which are already exposed---it cannot be used
by the host to add addional GPIOs.
### PROP 4098: PROP\_GPIO\_STATE ###
* Type: Read-Write
Contains a bit field identifying the state of the GPIOs. The length of
the data associated with these properties depends on the number of
GPIOs. If you have 10 GPIOs, you'd have two bytes. GPIOs are numbered
from most significant bit to least significant bit, so 0x80 is GPIO 0,
0x40 is GPIO 1, etc.
For GPIOs configured as inputs:
* `CMD_PROP_VAUE_GET`: The value of the associated bit describes the
logic level read from the pin.
* `CMD_PROP_VALUE_SET`: The value of the associated bit is ignored
for these pins.
For GPIOs configured as outputs:
* `CMD_PROP_VAUE_GET`: The value of the associated bit is
implementation specific.
* `CMD_PROP_VALUE_SET`: The value of the associated bit determines
the new logic level of the output. If this pin is configured as an
open-drain, setting the associated bit to 1 will cause the pin to
enter a Hi-Z state.
For GPIOs which are not specified in `PROP_GPIO_CONFIG`:
* `CMD_PROP_VAUE_GET`: The value of the associated bit is
implementation specific.
* `CMD_PROP_VALUE_SET`: The value of the associated bit MUST be
ignored by the NCP.
When writing, unspecified bits are assumed to be zero.
### PROP 4099: PROP\_GPIO\_STATE\_SET ###
* Type: Write-only
Allows for the state of various output GPIOs to be set without
affecting other GPIO states. Contains a bit field identifying the
output GPIOs that should have their state set to 1.
When writing, unspecified bits are assumed to be zero. The value of
any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST
be ignored.
### PROP 4100: PROP\_GPIO\_STATE\_CLEAR ###
* Type: Write-only
Allows for the state of various output GPIOs to be cleared without
affecting other GPIO states. Contains a bit field identifying the
output GPIOs that should have their state cleared to 0.
When writing, unspecified bits are assumed to be zero. The value of
any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST
be ignored.
@@ -1,95 +0,0 @@
# Feature: Host Buffer Offload
The memory on an NCP may be much more limited than the memory on
the host processor. In such situations, it is sometimes useful
for the NCP to offload buffers to the host processor temporarily
so that it can perform other operations.
Host buffer offload is an optional NCP capability that, when
present, allows the NCP to store data buffers on the host processor
that can be recalled at a later time.
The presence of this feature can be detected by the host by
checking for the presence of the `CAP_HBO`
capability in `PROP_CAPS`.
## Commands
### CMD 12: (NCP->Host) CMD_HBO_OFFLOAD
* Argument-Encoding: `LscD`
* `OffloadId`: 32-bit unique block identifier
* `Expiration`: In seconds-from-now
* `Priority`: Critical, High, Medium, Low
* `Data`: Data to offload
### CMD 13: (NCP->Host) CMD_HBO_RECLAIM
* Argument-Encoding: `Lb`
* `OffloadId`: 32-bit unique block identifier
* `KeepAfterReclaim`: If not set to true, the block will be
dropped by the host after it is sent to the NCP.
### CMD 14: (NCP->Host) CMD_HBO_DROP
* Argument-Encoding: `L`
* `OffloadId`: 32-bit unique block identifier
### CMD 15: (Host->NCP) CMD_HBO_OFFLOADED
* Argument-Encoding: `Li`
* `OffloadId`: 32-bit unique block identifier
* `Status`: Status code for the result of the operation.
### CMD 16: (Host->NCP) CMD_HBO_RECLAIMED
* Argument-Encoding: `LiD`
* `OffloadId`: 32-bit unique block identifier
* `Status`: Status code for the result of the operation.
* `Data`: Data that was previously offloaded (if any)
### CMD 17: (Host->NCP) CMD_HBO_DROPPED
* Argument-Encoding: `Li`
* `OffloadId`: 32-bit unique block identifier
* `Status`: Status code for the result of the operation.
## Properties
### PROP 10: PROP_HBO_MEM_MAX {#prop-hbo-mem-max}
* Type: Read-Write
* Packed-Encoding: `L`
Octets: | 4
--------|-----------------
Fields: | `PROP_HBO_MEM_MAX`
Describes the number of bytes that may be offloaded from the NCP to
the host. Default value is zero, so this property must be set by the
host to a non-zero value before the NCP will begin offloading blocks.
This value is encoded as an unsigned 32-bit integer.
This property is only available if the `CAP_HBO`
capability is present in `PROP_CAPS`.
### PROP 11: PROP_HBO_BLOCK_MAX {#prop-hbo-block-max}
* Type: Read-Write
* Packed-Encoding: `S`
Octets: | 2
--------|-----------------
Fields: | `PROP_HBO_BLOCK_MAX`
Describes the number of blocks that may be offloaded from the NCP to
the host. Default value is 32. Setting this value to zero will cause
host block offload to be effectively disabled.
This value is encoded as an unsigned 16-bit integer.
This property is only available if the `CAP_HBO`
capability is present in `PROP_CAPS`.
@@ -1,97 +0,0 @@
# Feature: Jam Detection {#feature-jam-detect}
Jamming detection is a feature that allows the NCP to report when it
detects high levels of interference that are characteristic of intentional
signal jamming.
The presence of this feature can be detected by checking for the
presence of the `CAP_JAM_DETECT` (value 6) capability in `PROP_CAPS`.
## Properties
### PROP 4608: PROP_JAM_DETECT_ENABLE {#prop-jam-detect-enable}
* Type: Read-Write
* Packed-Encoding: `b`
* Default Value: false
* REQUIRED for `CAP_JAM_DETECT`
Octets: | 1
--------|-----------------
Fields: | `PROP_JAM_DETECT_ENABLE`
Indicates if jamming detection is enabled or disabled. Set to true
to enable jamming detection.
This property is only available if the `CAP_JAM_DETECT`
capability is present in `PROP_CAPS`.
### PROP 4609: PROP_JAM_DETECTED {#prop-jam-detected}
* Type: Read-Only
* Packed-Encoding: `b`
* REQUIRED for `CAP_JAM_DETECT`
Octets: | 1
--------|-----------------
Fields: | `PROP_JAM_DETECTED`
Set to true if radio jamming is detected. Set to false otherwise.
When jamming detection is enabled, changes to the value of this
property are emitted asynchronously via `CMD_PROP_VALUE_IS`.
This property is only available if the `CAP_JAM_DETECT`
capability is present in `PROP_CAPS`.
### PROP 4610: PROP_JAM_DETECT_RSSI_THRESHOLD
* Type: Read-Write
* Packed-Encoding: `c`
* Units: dBm
* Default Value: Implementation-specific
* RECOMMENDED for `CAP_JAM_DETECT`
This parameter describes the threshold RSSI level (measured in
dBm) above which the jamming detection will consider the
channel blocked.
### PROP 4611: PROP_JAM_DETECT_WINDOW
* Type: Read-Write
* Packed-Encoding: `c`
* Units: Seconds (1-64)
* Default Value: Implementation-specific
* RECOMMENDED for `CAP_JAM_DETECT`
This parameter describes the window period for signal jamming
detection.
### PROP 4612: PROP_JAM_DETECT_BUSY
* Type: Read-Write
* Packed-Encoding: `i`
* Units: Seconds (1-64)
* Default Value: Implementation-specific
* RECOMMENDED for `CAP_JAM_DETECT`
This parameter describes the number of aggregate seconds within
the detection window where the RSSI must be above
`PROP_JAM_DETECT_RSSI_THRESHOLD` to trigger detection.
The behavior of the jamming detection feature when `PROP_JAM_DETECT_BUSY`
is larger than `PROP_JAM_DETECT_WINDOW` is undefined.
### PROP 4613: PROP_JAM_DETECT_HISTORY_BITMAP
* Type: Read-Only
* Packed-Encoding: `X`
* Default Value: Implementation-specific
* RECOMMENDED for `CAP_JAM_DETECT`
This value provides information about current state of jamming detection
module for monitoring/debugging purpose. It returns a 64-bit value where
each bit corresponds to one second interval starting with bit 0 for the
most recent interval and bit 63 for the oldest intervals (63 sec earlier).
The bit is set to 1 if the jamming detection module observed/detected
high signal level during the corresponding one second interval.
@@ -1,74 +0,0 @@
# Feature: Network Save
The network save/recall feature is an optional NCP capability that, when
present, allows the host to save and recall network credentials and
state to and from nonvolatile storage.
The presence of the save/recall feature can be detected by checking for
the presence of the `CAP_NET_SAVE` capability in `PROP_CAPS`.
Network clear feature allows host to erase all network credentials and
state from non-volatile memory.
## Commands
### CMD 9: (Host->NCP) CMD_NET_SAVE
Octets: | 1 | 1
--------|--------|--------------
Fields: | HEADER | CMD_NET_SAVE
Save network state command. Saves any current network credentials and
state necessary to reconnect to the current network to non-volatile
memory.
This operation affects non-volatile memory only. The current network
information stored in volatile memory is unaffected.
The response to this command is always a `CMD_PROP_VALUE_IS` for
`PROP_LAST_STATUS`, indicating the result of the operation.
This command is only available if the `CAP_NET_SAVE` capability is
set.
### CMD 10: (Host->NCP) CMD_NET_CLEAR
Octets: | 1 | 1
--------|--------|---------------
Fields: | HEADER | CMD_NET_CLEAR
Clear saved network settings command. Erases all network credentials
and state from non-volatile memory. The erased settings include any data
saved automatically by the network stack firmware and/or data saved by
`CMD_NET_SAVE` operation.
This operation affects non-volatile memory only. The current network
information stored in volatile memory is unaffected.
The response to this command is always a `CMD_PROP_VALUE_IS` for
`PROP_LAST_STATUS`, indicating the result of the operation.
This command is always available independent of the value of
`CAP_NET_SAVE` capability.
### CMD 11: (Host->NCP) CMD_NET_RECALL
Octets: | 1 | 1
--------|--------|----------------
Fields: | HEADER | CMD_NET_RECALL
Recall saved network state command. Recalls any previously saved
network credentials and state previously stored by `CMD_NET_SAVE` from
non-volatile memory.
This command will typically generated several unsolicited property
updates as the network state is loaded. At the conclusion of loading,
the authoritative response to this command is always a
`CMD_PROP_VALUE_IS` for `PROP_LAST_STATUS`, indicating the result of
the operation.
This command is only available if the `CAP_NET_SAVE` capability is
set.
@@ -1,77 +0,0 @@
# Feature: True Random Number Generation {#feature-trng}
This feature allows the host to have access to any strong hardware
random number generator that might be present on the NCP, for things
like key generation or seeding PRNGs.
Support for this feature can be determined by the presence of `CAP_TRNG`.
Note well that implementing a cryptographically-strong software-based true
random number generator (that is impervious to things like temperature
changes, manufacturing differences across devices, or unexpected output
correlations) is non-trivial without a well-designed, dedicated hardware
random number generator. Implementors who have little or no experience in
this area are encouraged to not advertise this capability.
## Properties ##
### PROP 4101: PROP_TRNG_32 ###
* Argument-Encoding: `L`
* Type: Read-Only
Fetching this property returns a strong random 32-bit integer that is suitable
for use as a PRNG seed or for cryptographic use.
While the exact mechanism behind the calculation of this value is
implementation-specific, the implementation must satisfy the following
requirements:
* Data representing at least 32 bits of fresh entropy (extracted from the
primary entropy source) MUST be consumed by the calculation of each query.
* Each of the 32 bits returned MUST be free of bias and have no statistical
correlation to any part of the raw data used for the calculation of any
query.
Support for this property is REQUIRED if `CAP_TRNG` is included in the
device capabilities.
### PROP 4102: PROP_TRNG_128 ###
* Argument-Encoding: `D`
* Type: Read-Only
Fetching this property returns 16 bytes of strong random data suitable for
direct cryptographic use without further processing(For example, as an
AES key).
While the exact mechanism behind the calculation of this value is
implementation-specific, the implementation must satisfy the following
requirements:
* Data representing at least 128 bits of fresh entropy (extracted from the
primary entropy source) MUST be consumed by the calculation of each query.
* Each of the 128 bits returned MUST be free of bias and have no statistical
correlation to any part of the raw data used for the calculation of any
query.
Support for this property is REQUIRED if `CAP_TRNG` is included in the
device capabilities.
### PROP 4103: PROP_TRNG_RAW_32 ###
* Argument-Encoding: `D`
* Type: Read-Only
This property is primarily used to diagnose and debug the behavior
of the entropy source used for strong random number generation.
When queried, returns the raw output from the entropy source used to
generate `PROP_TRNG_32`, prior to any reduction/whitening and/or mixing
with prior state.
The length of the returned buffer is implementation specific and should be
expected to be non-deterministic.
Support for this property is RECOMMENDED if `CAP_TRNG` is included in the
device capabilities.
@@ -1,83 +0,0 @@
# Frame Format ##
A frame is defined simply as the concatenation of
* A header byte
* A command (up to three bytes, see (#packed-unsigned-integer) for format)
* An optional command payload
Octets: | 1 | 1-3 | *n*
--------|--------|-----|-------------
Fields: | HEADER | CMD | CMD_PAYLOAD
## Header Format ###
The header byte is broken down as follows:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| FLG | NLI | TID |
+---+---+---+---+---+---+---+---+
<!-- RQ -- Eventually, when https://github.com/miekg/mmark/issues/95
is addressed, the above table should be swapped out with this:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| FLG || NLI || TID ||||
-->
### FLG: Flag
The flag field of the header byte (`FLG`) is always set to the value
two (or `10` in binary). Any frame received with these bits set to
any other value else MUST NOT be considered a Spinel frame.
This convention allows Spinel to be line compatible with BTLE HCI. By
defining the first two bit in this way we can disambiguate between
Spinel frames and HCI frames (which always start with either `0x01`
or `0x04`) without any additional framing overhead.
### NLI: Network Link Identifier
The Network Link Identifier (NLI) is a number between 0 and 3, which is associated by the OS with one of up to four IPv6 zone indices corresponding to conceptual IPv6 interfaces on the NCP. This allows the protocol to support IPv6 nodes connecting simultaneously to more than one IPv6 network link using a single NCP instance. The first Network Link Identifier (0) MUST refer to a distinguished conceptual interface provided by the NCP for its IPv6 link type. The other three Network Link Identifiers (1, 2 and 3) MAY be dissociated from any conceptual interface.
### TID: Transaction Identifier
The least significant bits of the header represent the Transaction
Identifier(TID). The TID is used for correlating responses to the
commands which generated them.
When a command is sent from the host, any reply to that command sent
by the NCP will use the same value for the TID. When the host receives
a frame that matches the TID of the command it sent, it can easily
recognize that frame as the actual response to that command.
The TID value of zero (0) is used for commands to which a correlated
response is not expected or needed, such as for unsolicited update
commands sent to the host from the NCP.
### Command Identifier (CMD) ####
The command identifier is a 21-bit unsigned integer encoded in up to
three bytes using the packed unsigned integer format described in
(#packed-unsigned-integer). This encoding allows for up to 2,097,152 individual
commands, with the first 127 commands represented as a single byte.
Command identifiers larger than 2,097,151 are explicitly forbidden.
CID Range | Description
----------------------|------------------
0 - 63 | Reserved for core commands
64 - 15,359 | *UNALLOCATED*
15,360 - 16,383 | Vendor-specific
16,384 - 1,999,999 | *UNALLOCATED*
2,000,000 - 2,097,151 | Experimental use only
### Command Payload (Optional) ####
Depending on the semantics of the command in question, a payload MAY
be included in the frame. The exact composition and length of the
payload is defined by the command identifier.
-223
View File
@@ -1,223 +0,0 @@
# Framing Protocol
Since this NCP protocol is defined independently of the physical
transport or framing, any number of transports and framing protocols
could be used successfully. However, in the interests of compatibility,
this document provides some recommendations.
## UART Recommendations ###
The recommended default UART settings are:
* Bit rate: 115200
* Start bits: 1
* Data bits: 8
* Stop bits: 1
* Parity: None
* Flow Control: Hardware
These values may be adjusted depending on the individual needs of
the application or product, but some sort of flow control **MUST** be used.
Hardware flow control is preferred over software flow control. In the
absence of hardware flow control, software flow control (XON/XOFF) **MUST**
be used instead.
We also **RECOMMEND** an Arduino-style hardware reset, where the DTR
signal is coupled to the `R̅E̅S̅` pin through a 0.01µF capacitor. This
causes the NCP to automatically reset whenever the serial port is
opened. At the very least we **RECOMMEND** dedicating one of your host
pins to controlling the `R̅E̅S̅` pin on the NCP, so that you can
easily perform a hardware reset if necessary.
### UART Bit Rate Detection ###
When using a UART, the issue of an appropriate bit rate must be
considered. A bitrate of 115200 bits per second has become a defacto
standard baud rate for many serial peripherals. This rate, however,
is slower than the theoretical maximum bitrate of the 802.15.4 2.4GHz
PHY (250kbit). In most circumstances this mismatch is not significant
because the overall bitrate will be much lower than either of these
rates, but there are circumstances where a faster UART bitrate is
desirable. Thus, this document proposes a simple bitrate detection
scheme that can be employed by the host to detect when the attached
NCP is initially running at a higher bitrate.
The algorithm is to send successive NOOP commands to the NCP at increasing
bitrates. When a valid `CMD_LAST_STATUS` response has been received, we
have identified the correct bitrate.
In order to limit the time spent hunting for the appropriate bitrate,
we RECOMMEND that only the following bitrates be checked:
* 115200
* 230400
* 1000000 (1Mbit)
The bitrate MAY also be changed programmatically by adjusting
`PROP_UART_BITRATE`, if implemented.
### HDLC-Lite {#hdlc-lite}
*HDLC-Lite* is the recommended framing protocol for transmitting
Spinel frames over a UART. HDLC-Lite consists of only the framing,
escaping, and CRC parts of the larger HDLC protocol---all other parts
of HDLC are omitted. This protocol was chosen because it works well
with software flow control and is widely implemented.
To transmit a frame with HDLC-lite, the 16-bit CRC must first be
appended to the frame. The CRC function is defined to be CRC-16/CCITT,
otherwise known as the [KERMIT CRC][].
[KERMIT CRC]: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.kermit
Individual frames are terminated with a frame delimiter octet called
the 'flag' octet (`0x7E`).
The following octets values are considered *special* and should be
escaped when present in data frames:
Octet Value | Description
------------|-----------------------
0x7E | Frame Delimiter (Flag)
0x7D | Escape Byte
0x11 | XON
0x13 | XOFF
0xF8 | Vendor-Specific
When present in a data frame, these octet values are escaped by
prepending the escape octet (`0x7D`) and XORing the value with `0x20`.
When receiving a frame, the CRC must be verified after the frame is
unescaped. If the CRC value does not match what is calculated for the
frame data, the frame MUST be discarded. The implementation MAY
indicate the failure to higher levels to handle as they see fit, but
MUST NOT attempt to process the deceived frame.
Consecutive flag octets are entirely legal and MUST NOT be treated as
a framing error. Consecutive flag octets MAY be used as a way to wake
up a sleeping NCP.
When first establishing a connection to the NCP, it is customary to
send one or more flag octets to ensure that any previously received
data is discarded.
## SPI Recommendations ###
We RECOMMEND the use of the following standard SPI signals:
* `C̅S̅`: (Host-to-NCP) Chip Select
* `CLK`: (Host-to-NCP) Clock
* `MOSI`: Master-Output/Slave-Input
* `MISO`: Master-Input/Slave-Output
* `I̅N̅T̅`: (NCP-to-Host) Host Interrupt
* `R̅E̅S̅`: (Host-to-NCP) NCP Hardware Reset
The `I̅N̅T̅` signal is used by the NCP to indicate to the host that
the NCP has frames pending to send to it. When asserted, the host
SHOULD initiate a SPI transaction in a timely manner.
We RECOMMEND the following SPI properties:
* `C̅S̅` is active low.
* `CLK` is active high.
* `CLK` speed is larger than 500 kHz.
* Data is valid on leading edge of `CLK`.
* Data is sent in multiples of 8-bits (octets).
* Octets are sent most-significant bit first.
This recommended configuration may be adjusted depending on the
individual needs of the application or product.
### SPI Framing Protocol ####
Each SPI frame starts with a 5-byte frame header:
Octets: | 1 | 2 | 2
--------|-----|----------|----------
Fields: | HDR | RECV_LEN | DATA_LEN
* `HDR`: The first byte is the header byte (defined below)
* `RECV_LEN`: The second and third bytes indicate the largest frame
size that that device is ready to receive. If zero, then the other
device must not send any data. (Little endian)
* `DATA_LEN`: The fourth and fifth bytes indicate the size of the
pending data frame to be sent to the other device. If this value
is equal-to or less-than the number of bytes that the other device
is willing to receive, then the data of the frame is immediately
after the header. (Little Endian)
The `HDR` byte is defined as:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
|RST|CRC|CCF| RESERVED |PATTERN|
+---+---+---+---+---+---+---+---+
* `RST`: This bit is set when that device has been reset since the
last time `C̅S̅` was asserted.
* `CRC`: This bit is set when that device supports writing a 16-bit
CRC at the end of the data. The CRC length is NOT included in DATA_LEN.
* `CCF`: "CRC Check Failure". Set if the CRC check on the last received
frame failed, cleared to zero otherwise. This bit is only used if both
sides support CRC.
* `RESERVED`: These bits are all reserved for future used. They
MUST be cleared to zero and MUST be ignored if set.
* `PATTERN`: These bits are set to a fixed value to help distinguish
valid SPI frames from garbage (by explicitly making `0xFF` and `0x00`
invalid values). Bit 6 MUST be set to be one and bit 7 MUST be
cleared (0). A frame received that has any other values for these bits
MUST be dropped.
Prior to a sending or receiving a frame, the master MAY send a
5-octet frame with zeros for both the max receive frame size and the
the contained frame length. This will induce the slave device to
indicate the length of the frame it wants to send (if any) and
indicate the largest frame it is capable of receiving at the moment.
This allows the master to calculate the size of the next transaction.
Alternatively, if the master has a frame to send it can just go ahead
and send a frame of that length and determine if the frame was accepted
by checking that the `RECV_LEN` from the slave frame is larger than
the frame the master just tried to send. If the `RECV_LEN` is smaller
then the frame wasn't accepted and will need to be transmitted again.
This protocol can be used either unidirectionally or bidirectionally,
determined by the behavior of the master and the slave.
If the the master notices `PATTERN` is not set correctly, the master
should consider the transaction to have failed and try again after 10
milliseconds, retrying up to 200 times. After unsuccessfully trying
200 times in a row, the master MAY take appropriate remedial action
(like a NCP hardware reset, or indicating a communication failure to a
user interface).
At the end of the data of a frame is an optional 16-bit CRC, support for
which is indicated by the `CRC` bit of the `HDR` byte being set. If these
bits are set for both the master and slave frames, then CRC checking is
enabled on both sides, effectively requiring that frame sizes be two bytes
longer than would be otherwise required. The CRC is calculated using the
same mechanism used for the CRC calculation in HDLC-Lite (See (#hdlc-lite)).
When both of the `CRC` bits are set, both sides must verify that the `CRC`
is valid before accepting the frame. If not enough bytes were clocked out
for the CRC to be read, then the frame must be ignored. If enough bytes
were clocked out to perform a CRC check, but the CRC check fails, then
the frame must be rejected and the `CRC_FAIL` bit on the next frame (and
ONLY the next frame) MUST be set.
## I²C Recommendations {#i2c-recommendations}
TBD
<!-- RQ
-- It may make sense to have a look at what Bluetooth HCI is doing
for native I²C framing and go with that.
-->
## Native USB Recommendations ###
TBD
<!-- RQ
-- It may make sense to have a look at what Bluetooth HCI is doing
for native USB framing and go with that.
-->
-584
View File
@@ -1,584 +0,0 @@
## Core Properties {#prop-core}
### PROP 0: PROP_LAST_STATUS {#prop-last-status}
* Type: Read-Only
* Encoding: `i`
Octets: | 1-3
-------:|-------------
Fields: | LAST_STATUS
Describes the status of the last operation. Encoded as a packed
unsigned integer.
This property is emitted often to indicate the result status of
pretty much any Host-to-NCP operation.
It is emitted automatically at NCP startup with a value indicating
the reset reason.
See (#status-codes) for the complete list of status codes.
### PROP 1: PROP_PROTOCOL_VERSION {#prop-protocol-version}
* Type: Read-Only
* Encoding: `ii`
Octets: | 1-3 | 1-3
--------|----------------|---------------
Fields: | MAJOR_VERSION | MINOR_VERSION
Describes the protocol version information. This property contains
four fields, each encoded as a packed unsigned integer:
* Major Version Number
* Minor Version Number
This document describes major version 4, minor version 3 of this protocol.
The host **MUST** only use this property from NLI 0. Behavior when used
from other NLIs is undefined.
#### Major Version Number
The major version number is used to identify large and incompatible
differences between protocol versions.
The host MUST enter a FAULT state if it does not explicitly support
the given major version number.
#### Minor Version Number
The minor version number is used to identify small but otherwise
compatible differences between protocol versions. A mismatch between
the advertised minor version number and the minor version that is
supported by the host SHOULD NOT be fatal to the operation of the
host.
### PROP 2: PROP_NCP_VERSION {#prop-ncp-version}
* Type: Read-Only
* Packed-Encoding: `U`
Octets: | *n*
--------|-------------------
Fields: | NCP_VESION_STRING
Contains a string which describes the firmware currently running on
the NCP. Encoded as a zero-terminated UTF-8 string.
The format of the string is not strictly defined, but it is intended
to present similarly to the "User-Agent" string from HTTP. The
RECOMMENDED format of the string is as follows:
STACK-NAME/STACK-VERSION[BUILD_INFO][; OTHER_INFO]; BUILD_DATE_AND_TIME
Examples:
* `OpenThread/1.0d26-25-gb684c7f; DEBUG; May 9 2016 18:22:04`
* `ConnectIP/2.0b125 s1 ALPHA; Sept 24 2015 20:49:19`
The host **MUST** only use this property from NLI 0. Behavior when used
from other NLIs is undefined.
### PROP 3: PROP_INTERFACE_TYPE {#prop-interface-type}
* Type: Read-Only
* Encoding: `i`
Octets: | 1-3
--------|----------------
Fields: | INTERFACE_TYPE
This integer identifies what the network protocol for this NCP.
Currently defined values are:
* 0: Bootloader
* 2: ZigBee IP(TM)
* 3: Thread(R)
The host MUST enter a FAULT state if it does not recognize the
protocol given by the NCP.
### PROP 4: PROP_INTERFACE_VENDOR_ID {#prop-interface-vendor-id}
* Type: Read-Only
* Encoding: `i`
Octets: | 1-3
--------|----------------
Fields: | VENDOR_ID
Vendor identifier.
### PROP 5: PROP_CAPS {#prop-caps}
* Type: Read-Only
* Packed-Encoding: `A(i)`
Octets: | 1-3 | 1-3 | ...
--------|-------|-------|-----
Fields: | CAP_1 | CAP_2 | ...
Describes the supported capabilities of this NCP. Encoded as a list of
packed unsigned integers.
A capability is defined as a 21-bit integer that describes a subset of
functionality which is supported by the NCP.
Currently defined values are:
* 1: `CAP_LOCK`
* 2: `CAP_NET_SAVE`
* 3: `CAP_HBO`: Host Buffer Offload. See (#feature-host-buffer-offload).
* 4: `CAP_POWER_SAVE`
* 5: `CAP_COUNTERS`
* 6: `CAP_JAM_DETECT`: Jamming detection. See (#feature-jam-detect)
* 7: `CAP_PEEK_POKE`: PEEK/POKE debugging commands.
* 8: `CAP_WRITABLE_RAW_STREAM`: `PROP_STREAM_RAW` is writable.
* 9: `CAP_GPIO`: Support for GPIO access. See (#feature-gpio-access).
* 10: `CAP_TRNG`: Support for true random number generation. See (#feature-trng).
* 11: `CAP_CMD_MULTI`: Support for `CMD_PROP_VALUE_MULTI_GET` ((#cmd-prop-value-multi-get)), `CMD_PROP_VALUE_MULTI_SET` ((#cmd-prop-value-multi-set), and `CMD_PROP_VALUES_ARE` ((#cmd-prop-values-are)).
* 12: `CAP_UNSOL_UPDATE_FILTER`: Support for `PROP_UNSOL_UPDATE_FILTER` ((#prop-unsol-update-filter)) and `PROP_UNSOL_UPDATE_LIST` ((#prop-unsol-update-list)).
* 13: `CAP_MCU_POWER_SAVE`: Support for controlling NCP's MCU power state (`PROP_MCU_POWER_STATE`).
* 16: `CAP_802_15_4_2003`
* 17: `CAP_802_15_4_2006`
* 18: `CAP_802_15_4_2011`
* 21: `CAP_802_15_4_PIB`
* 24: `CAP_802_15_4_2450MHZ_OQPSK`
* 25: `CAP_802_15_4_915MHZ_OQPSK`
* 26: `CAP_802_15_4_868MHZ_OQPSK`
* 27: `CAP_802_15_4_915MHZ_BPSK`
* 28: `CAP_802_15_4_868MHZ_BPSK`
* 29: `CAP_802_15_4_915MHZ_ASK`
* 30: `CAP_802_15_4_868MHZ_ASK`
* 48: `CAP_ROLE_ROUTER`
* 49: `CAP_ROLE_SLEEPY`
* 52: `CAP_NET_THREAD_1_0`
* 512: `CAP_MAC_WHITELIST`
* 513: `CAP_MAC_RAW`
* 514: `CAP_OOB_STEERING_DATA`
* 1024: `CAP_THREAD_COMMISSIONER`
* 1025: `CAP_THREAD_TMF_PROXY`
Additionally, future capability allocations SHALL be made from the
following allocation plan:
Capability Range | Description
----------------------|------------------
0 - 127 | Reserved for core capabilities
128 - 15,359 | *UNALLOCATED*
15,360 - 16,383 | Vendor-specific
16,384 - 1,999,999 | *UNALLOCATED*
2,000,000 - 2,097,151 | Experimental use only
### PROP 6: PROP_INTERFACE_COUNT {#prop-interface-count}
* Type: Read-Only
* Packed-Encoding: `C`
Octets: | 1
--------|-----------------
Fields: | `INTERFACE_COUNT`
Describes the number of concurrent interfaces supported by this NCP.
Since the concurrent interface mechanism is still TBD, this value MUST
always be one.
This value is encoded as an unsigned 8-bit integer.
The host **MUST** only use this property from NLI 0. Behavior when used
from other NLIs is undefined.
### PROP 7: PROP_POWER_STATE {#prop-power-state} (deprecated)
* Type: Read-Write
* Packed-Encoding: `C`
Octets: | 1
--------|------------------
Fields: | POWER_STATE
This property is **deprecated**. `MCU_POWER_STATE` provides similar
functionality.
Describes the current power state of the NCP. By writing to this
property you can manage the lower state of the NCP. Enumeration is
encoded as a single unsigned byte.
Defined values are:
* 0: `POWER_STATE_OFFLINE`: NCP is physically powered off.
(Enumerated for completeness sake, not expected on the wire)
* 1: `POWER_STATE_DEEP_SLEEP`: Almost everything on the NCP is shut
down, but can still be resumed via a command or interrupt.
* 2: `POWER_STATE_STANDBY`: NCP is in the lowest power state that
can still be awoken by an event from the radio (e.g. waiting for
alarm)
* 3: `POWER_STATE_LOW_POWER`: NCP is responsive (and possibly
connected), but using less power. (e.g. "Sleepy" child node)
* 4: `POWER_STATE_ONLINE`: NCP is fully powered. (e.g. "Parent"
node)
<!-- RQ
-- We should consider reversing the numbering here so that 0 is
`POWER_STATE_ONLINE`. We may also want to include some extra
values between the defined values for future expansion, so
that we can preserve the ordered relationship. -- -->
### PROP 8: PROP_HWADDR {#prop-hwaddr}
* Type: Read-Only\*
* Packed-Encoding: `E`
Octets: | 8
--------|------------
Fields: | HWADDR
The static EUI64 address of the device, used as a serial number.
This value is read-only, but may be writable under certain
vendor-defined circumstances.
### PROP 9: PROP_LOCK {#prop-lock}
* Type: Read-Write
* Packed-Encoding: `b`
Octets: | 1
--------|------------
Fields: | LOCK
Property lock. Used for grouping changes to several properties to
take effect at once, or to temporarily prevent the automatic updating
of property values. When this property is set, the execution of the
NCP is effectively frozen until it is cleared.
This property is only supported if the `CAP_LOCK` capability is present.
Unlike most other properties, setting this property to true when the
value of the property is already true **MUST** fail with a last status
of `STATUS_ALREADY`.
### PROP 12: PROP_HOST_POWER_STATE {#prop-host-power-state}
* Type: Read-Write
* Packed-Encoding: `C`
* Default value: 4
Octets: | 1
--------|------------------
Fields: | `HOST_POWER_STATE`
Describes the current power state of the *host*. This property is used
by the host to inform the NCP when it has changed power states. The
NCP can then use this state to determine which properties need
asynchronous updates. Enumeration is encoded as a single unsigned
byte. These states are defined in similar terms to `PROP_POWER_STATE`
((#prop-power-state)).
Defined values are:
* 0: `HOST_POWER_STATE_OFFLINE`: Host is physically powered off and
cannot be woken by the NCP. All asynchronous commands are
squelched.
* 1: `HOST_POWER_STATE_DEEP_SLEEP`: The host is in a low power state
where it can be woken by the NCP but will potentially require more
than two seconds to become fully responsive. The NCP **MUST**
avoid sending unnecessary property updates, such as child table
updates or non-critical messages on the debug stream. If the NCP
needs to wake the host for traffic, the NCP **MUST** first take
action to wake the host. Once the NCP signals to the host that it
should wake up, the NCP **MUST** wait for some activity from the
host (indicating that it is fully awake) before sending frames.
* 2: **RESERVED**. This value **MUST NOT** be set by the host. If
received by the NCP, the NCP **SHOULD** consider this as a synonym
of `HOST_POWER_STATE_DEEP_SLEEP`.
* 3: `HOST_POWER_STATE_LOW_POWER`: The host is in a low power state
where it can be immediately woken by the NCP. The NCP **SHOULD**
avoid sending unnecessary property updates, such as child table
updates or non-critical messages on the debug stream.
* 4: `HOST_POWER_STATE_ONLINE`: The host is awake and responsive. No
special filtering is performed by the NCP on asynchronous updates.
* All other values are **RESERVED**. They MUST NOT be set by the
host. If received by the NCP, the NCP **SHOULD** consider the value as
a synonym of `HOST_POWER_STATE_LOW_POWER`.
<!-- RQ
-- We should consider reversing the numbering here so that 0 is
`POWER_STATE_ONLINE`. We may also want to include some extra
values between the defined values for future expansion, so
that we can preserve the ordered relationship. -- -->
After setting this power state, any further commands from the host to
the NCP will cause `HOST_POWER_STATE` to automatically revert to
`HOST_POWER_STATE_ONLINE`.
When the host is entering a low-power state, it should wait for the
response from the NCP acknowledging the command (with `CMD_VALUE_IS`).
Once that acknowledgement is received the host may enter the low-power
state.
If the NCP has the `CAP_UNSOL_UPDATE_FILTER` capability, any unsolicited
property updates masked by `PROP_UNSOL_UPDATE_FILTER` should be honored
while the host indicates it is in a low-power state. After resuming to the
`HOST_POWER_STATE_ONLINE` state, the value of `PROP_UNSOL_UPDATE_FILTER`
**MUST** be unchanged from the value assigned prior to the host indicating
it was entering a low-power state.
The host **MUST** only use this property from NLI 0. Behavior when used
from other NLIs is undefined.
### PROP 13: PROP_MCU_POWER_STATE {#prop-mcu-power-state}
* Type: Read-Write
* Packed-Encoding: `C`
* Required capability: CAP_MCU_POWER_SAVE
This property specifies the desired power state of NCP's micro-controller
(MCU) when the underlying platform's operating system enters idle mode (i.e.,
all active tasks/events are processed and the MCU can potentially enter a
energy-saving power state).
The power state primarily determines how the host should interact with the NCP
and whether the host needs an external trigger (a "poke") to NCP before it can
communicate with the NCP or not. After a reset, the MCU power state MUST be
`SPINEL_MCU_POWER_STATE_ON`.
Defined values are:
* 0: `SPINEL_MCU_POWER_STATE_ON`: NCP's MCU stays on and active all the time.
When the NCP's desired power state is set to this value, host can send
messages to NCP without requiring any "poke" or external triggers. MCU is
expected to stay on and active. Note that the `ON` power state only determines
the MCU's power mode and is not related to radio's state.
* 1: `SPINEL_MCU_POWER_STATE_LOW_POWER`: NCP's MCU can enter low-power
(energy-saving) state. When the NCP's desired power state is set to
`LOW_POWER`, host is expected to "poke" the NCP (e.g., an external trigger
like an interrupt) before it can communicate with the NCP (send a message
to the NCP). The "poke" mechanism is determined by the platform code (based
on NCP's interface to the host).
While power state is set to `LOW_POWER`, NCP can still (at any time) send
messages to host. Note that receiving a message from the NCP does NOT
indicate that the NCP's power state has changed, i.e., host is expected to
continue to "poke" NCP when it wants to talk to the NCP until the power
state is explicitly changed (by setting this property to `ON`).
Note that the `LOW_POWER` power state only determines the MCU's power mode
and is not related to radio's state.
* 2: `SPINEL_MCU_POWER_STATE_OFF`: NCP is fully powered off.
An NCP hardware reset (via a RESET pin) is required to bring the NCP back
to `SPINEL_MCU_POWER_STATE_ON`. RAM is not retained after reset.
### PROP 4104: PROP_UNSOL_UPDATE_FILTER {#prop-unsol-update-filter}
* Required only if `CAP_UNSOL_UPDATE_FILTER` is set.
* Type: Read-Write
* Packed-Encoding: `A(I)`
* Default value: Empty.
Contains a list of properties which are *excluded* from generating
unsolicited value updates. This property **MUST** be empty after reset.
In other words, the host may opt-out of unsolicited property updates
for a specific property by adding that property id to this list.
Hosts **SHOULD NOT** add properties to this list which are not
present in `PROP_UNSOL_UPDATE_LIST`. If such properties are added,
the NCP **MUST** ignore the unsupported properties.
<!-- RQ
-- The justification for the above behavior is to attempt to avoid possible
future interop problems by explicitly making sure that unknown
properties are ignored. Since unknown properties will obviously not be
generating unsolicited updates, it seems fairly harmless. An
implementation may print out a warning to the debug stream.
Note that the error is still detectable: If you VALUE\_SET unsupported
properties, the resulting VALUE\_IS would contain only the supported
properties of that set(since the unsupported properties would be
ignored). If an implementation cares that much about getting this
right then it needs to make sure that it checks
PROP\_UNSOL\_UPDATE\_LIST first.
-- -->
Implementations of this property are only **REQUIRED** to support
and use the following commands:
* `CMD_PROP_VALUE_GET` ((#cmd-prop-value-get))
* `CMD_PROP_VALUE_SET` ((#cmd-prop-value-set))
* `CMD_PROP_VALUE_IS` ((#cmd-prop-value-is))
Implementations of this property **MAY** optionally support and use
the following commands:
* `CMD_PROP_VALUE_INSERT` ((#cmd-prop-value-insert))
* `CMD_PROP_VALUE_REMOVE` ((#cmd-prop-value-remove))
* `CMD_PROP_VALUE_INSERTED` ((#cmd-prop-value-inserted))
* `CMD_PROP_VALUE_REMOVED` ((#cmd-prop-value-removed))
Host implementations which are aiming to maximize their compatability across
different firmwre implementations **SHOULD NOT** assume the availability of the
optional commands for this property.
The value of this property **SHALL** be independent for each NLI.
### PROP 4105: PROP_UNSOL_UPDATE_LIST {#prop-unsol-update-list}
* Required only if `CAP_UNSOL_UPDATE_FILTER` is set.
* Type: Read-Only
* Packed-Encoding: `A(I)`
Contains a list of properties which are capable of generating
unsolicited value updates. This list can be used when populating
`PROP_UNSOL_UPDATE_FILTER` to disable all unsolicited property
updates.
This property is intended to effectively behave as a constant
for a given NCP firmware.
Note that not all properties that support unsolicited updates need to
be listed here. Scan results, for example, are only generated due to
direct action on the part of the host, so those properties **MUST NOT**
not be included in this list.
The value of this property **MAY** be different across available
NLIs.
## Stream Properties {#prop-stream}
### PROP 112: PROP_STREAM_DEBUG {#prop-stream-debug}
* Type: Read-Only-Stream
* Packed-Encoding: `D`
Octets: | *n*
--------|------------
Fields: | UTF8_DATA
This property is a streaming property, meaning that you cannot explicitly
fetch the value of this property. The stream provides human-readable debugging
output which may be displayed in the host logs.
The location of newline characters is not assumed by the host: it is
the NCP's responsibility to insert newline characters where needed,
just like with any other text stream.
To receive the debugging stream, you wait for `CMD_PROP_VALUE_IS`
commands for this property from the NCP.
### PROP 113: PROP_STREAM_RAW {#prop-stream-raw}
* Type: Read-Write-Stream
* Packed-Encoding: `dD`
Octets: | 2 | *n* | *n*
--------|----------------|------------|----------------
Fields: | FRAME_DATA_LEN | FRAME_DATA | FRAME_METADATA
This stream provides the capability of sending and receiving raw packets
to and from the radio. The exact format of the frame metadata and data is
dependent on the MAC and PHY being used.
This property is a streaming property, meaning that you cannot explicitly
fetch the value of this property. To receive traffic, you wait for
`CMD_PROP_VALUE_IS` commands with this property id from the NCP.
Implementations may OPTIONALLY support the ability to transmit arbitrary
raw packets. Support for this feature is indicated by the presence of the
`CAP_WRITABLE_RAW_STREAM` capability.
If the capability `CAP_WRITABLE_RAW_STREAM` is set, then packets written
to this stream with `CMD_PROP_VALUE_SET` will be sent out over the radio.
This allows the caller to use the radio directly, with the stack being
implemented on the host instead of the NCP.
#### Frame Metadata Format {#frame-metadata-format}
Any data past the end of `FRAME_DATA_LEN` is considered metadata and is
OPTIONAL. Frame metadata MAY be empty or partially specified. Partially
specified metadata MUST be accepted. Default values are used for all
unspecified fields.
The same general format is used for `PROP_STREAM_RAW`, `PROP_STREAM_NET`,
and `PROP_STREAM_NET_INSECURE`. It can be used for frames sent from the
NCP to the host as well as frames sent from the host to the NCP.
The frame metadata field consists of the following fields:
Field | Description | Type | Len | Default
:--------|:-----------------------------|:-----------|-------|----------
MD_RSSI | (dBm) RSSI | `c` int8 | 1 | -128
MD_NOISE | (dBm) Noise floor | `c` int8 | 1 | -128
MD_FLAG | Flags (defined below) | `S` uint16 | 2 |
MD_PHY | PHY-specific data | `d` data | >=2 |
MD_VEND | Vendor-specific data | `d` data | >=2 |
The following fields are ignored by the NCP for packets sent to it from
the host:
* MD_NOISE
* MD_FLAG
The bit values in `MD_FLAG` are defined as follows:
Bit | Mask | Name | Description if set
---------|--------|:------------------|:----------------
15 | 0x0001 | MD_FLAG_TX | Packet was transmitted, not received.
13 | 0x0004 | MD_FLAG_BAD_FCS | Packet was received with bad FCS
12 | 0x0008 | MD_FLAG_DUPE | Packet seems to be a duplicate
0-11, 14 | 0xFFF2 | MD_FLAG_RESERVED | Flags reserved for future use.
The format of `MD_PHY` is specified by the PHY layer currently in use,
and may contain information such as the channel, LQI, antenna, or other
pertainent information.
### PROP 114: PROP_STREAM_NET {#prop-stream-net}
* Type: Read-Write-Stream
* Packed-Encoding: `dD`
Octets: | 2 | *n* | *n*
--------|----------------|------------|----------------
Fields: | FRAME_DATA_LEN | FRAME_DATA | FRAME_METADATA
This stream provides the capability of sending and receiving data packets
to and from the currently attached network. The exact format of the frame
metadata and data is dependent on the network protocol being used.
This property is a streaming property, meaning that you cannot explicitly
fetch the value of this property. To receive traffic, you wait for
`CMD_PROP_VALUE_IS` commands with this property id from the NCP.
To send network packets, you call `CMD_PROP_VALUE_SET` on this property with
the value of the packet.
Any data past the end of `FRAME_DATA_LEN` is considered metadata, the
format of which is described in (#frame-metadata-format).
### PROP 115: PROP_STREAM_NET_INSECURE {#prop-stream-net-insecure}
* Type: Read-Write-Stream
* Packed-Encoding: `dD`
Octets: | 2 | *n* | *n*
--------|----------------|------------|----------------
Fields: | FRAME_DATA_LEN | FRAME_DATA | FRAME_METADATA
This stream provides the capability of sending and receiving unencrypted
and unauthenticated data packets to and from nearby devices for the
purposes of device commissioning. The exact format of the frame
metadata and data is dependent on the network protocol being used.
This property is a streaming property, meaning that you cannot explicitly
fetch the value of this property. To receive traffic, you wait for
`CMD_PROP_VALUE_IS` commands with this property id from the NCP.
To send network packets, you call `CMD_PROP_VALUE_SET` on this property with
the value of the packet.
Any data past the end of `FRAME_DATA_LEN` is considered metadata, the
format of which is described in (#frame-metadata-format).
@@ -1,40 +0,0 @@
## Debug Properties {#prop-debug}
### PROP 16384: PROP_DEBUG_TEST_ASSERT {#prop-debug-test-assert}
* Type: Read-Only
* Packed-Encoding: `b`
Reading this property will cause an assert on the NCP. This
is intended for testing the assert functionality of
underlying platform/NCP. Assert should ideally cause the
NCP to reset, but if `assert` is not supported or disabled
boolean value of `false` is returned in response.
### PROP 16385: PROP_DEBUG_NCP_LOG_LEVEL {#prop-debug-ncp-log-level}
* Type: Read-Write
* Packed-Encoding: `C`
Provides access to the NCP log level. Currently defined values are (which follows
the RFC 5424):
* 0: Emergency (emerg).
* 1: Alert (alert).
* 2: Critical (crit).
* 3: Error (err).
* 4: Warning (warn).
* 5: Notice (notice).
* 6: Information (info).
* 7: Debug (debug).
If the NCP supports dynamic log level control, setting this property
changes the log level accordingly. Getting the value returns the current
log level. If the dynamic log level control is not supported, setting this
property returns a `PROP_LAST_STATUS` with `STATUS_INVALID_COMMAND_FOR_PROP`.
### PROP 16386: PROP_DEBUG_TEST_WATCHDOG {#prop-debug-test-watchdog}
* Type: Read-Only
* Packed-Encoding: Empty
Reading this property will causes NCP to start `while(true) ;` loop and
thus triggering a watchdog. This is intended for testing the watchdog
functionality on the underlying platform/NCP.
@@ -1,69 +0,0 @@
## IPv6 Properties {#prop-ipv6}
### PROP 96: PROP_IPV6_LL_ADDR {#prop-ipv6-ll-addr}
* Type: Read-Only
* Packed-Encoding: `6`
IPv6 Address
### PROP 97: PROP_IPV6_ML_ADDR {#prop-ipv6-ml-addr}
* Type: Read-Only
* Packed-Encoding: `6`
IPv6 Address + Prefix Length
### PROP 98: PROP_IPV6_ML_PREFIX {#prop-ipv6-ml-prefix}
* Type: Read-Write
* Packed-Encoding: `6C`
IPv6 Prefix + Prefix Length
### PROP 99: PROP_IPV6_ADDRESS_TABLE {#prop-ipv6-address-table}
* Type: Read-Write
* Packed-Encoding: `A(t(6CLLC))`
This property provides all unicast addresses.
Array of structures containing:
* `6`: IPv6 Address
* `C`: Network Prefix Length
* `L`: Valid Lifetime
* `L`: Preferred Lifetime
* `C`: Flags
### PROP 101: PROP_IPv6_ICMP_PING_OFFLOAD
* Type: Read-Write
* Packed-Encoding: `b`
Allow the NCP to directly respond to ICMP ping requests. If this is
turned on, ping request ICMP packets will not be passed to the host.
Default value is `false`.
### PROP 102: SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE {#prop-ipv6-multicast-address-table}
* Type: Read-Write
* Packed-Encoding: `A(t(6))`
Array of structures containing:
* `6`: Multicast IPv6 Address
### PROP 103: PROP_IPv6_ICMP_PING_OFFLOAD_MODE
* Type: Read-Write
* Packed-Encoding: `C`
* Unit: Enumeration
Allow the NCP to directly respond to ICMP ping requests. If this is
turned on, ping request ICMP packets will not be passed to the host.
This property allows enabling responses sent to unicast only, multicast
only, or both.
Values:
* 0: `IPV6_ICMP_PING_OFFLOAD_DISABLED`
* 1: `IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY`
* 2: `IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY`
* 3: `IPV6_ICMP_PING_OFFLOAD_ALL`
Default value is `IPV6_ICMP_PING_OFFLOAD_DISABLED`.
-210
View File
@@ -1,210 +0,0 @@
## MAC Properties {#prop-mac}
### PROP 48: PROP_MAC_SCAN_STATE {#prop-mac-scan-state}
* Type: Read-Write
* Packed-Encoding: `C`
* Unit: Enumeration
Possible Values:
* 0: `SCAN_STATE_IDLE`
* 1: `SCAN_STATE_BEACON`
* 2: `SCAN_STATE_ENERGY`
* 3: `SCAN_STATE_DISCOVER`
Set to `SCAN_STATE_BEACON` to start an active scan.
Beacons will be emitted from `PROP_MAC_SCAN_BEACON`.
Set to `SCAN_STATE_ENERGY` to start an energy scan.
Channel energy result will be reported by emissions
of `PROP_MAC_ENERGY_SCAN_RESULT` (per channel).
Set to `SCAN_STATE_DISOVER` to start a Thread MLE discovery
scan operation. Discovery scan result will be emitted from
`PROP_MAC_SCAN_BEACON`.
Value switches to `SCAN_STATE_IDLE` when scan is complete.
### PROP 49: PROP_MAC_SCAN_MASK {#prop-mac-scan-mask}
* Type: Read-Write
* Packed-Encoding: `A(C)`
* Unit: List of channels to scan
### PROP 50: PROP_MAC_SCAN_PERIOD {#prop-mac-scan-period}
* Type: Read-Write
* Packed-Encoding: `S` (uint16)
* Unit: milliseconds per channel
### PROP 51: PROP_MAC_SCAN_BEACON {#prop-mac-scan-beacon}
* Type: Read-Only-Stream
* Packed-Encoding: `Ccdd` (or `Cct(ESSc)t(iCUdd)`)
Octets: | 1 | 1 | 2 | *n* | 2 | *n*
--------|----|------|---------|----------|---------|----------
Fields: | CH | RSSI | MAC_LEN | MAC_DATA | NET_LEN | NET_DATA
Scan beacons have two embedded structures which contain
information about the MAC layer and the NET layer. Their
format depends on the MAC and NET layer currently in use.
The format below is for an 802.15.4 MAC with Thread:
* `C`: Channel
* `c`: RSSI of the beacon
* `t`: MAC layer properties (802.15.4 layer shown below for convenience)
* `E`: Long address
* `S`: Short address
* `S`: PAN-ID
* `c`: LQI
* NET layer properties (Standard net layer shown below for convenience)
* `i`: Protocol Number
* `C`: Flags
* `U`: Network Name
* `d`: XPANID
* `d`: Steering data
Extra parameters may be added to each of the structures
in the future, so care should be taken to read the length
that prepends each structure.
### PROP 52: PROP_MAC_15_4_LADDR {#prop-mac-15-4-laddr}
* Type: Read-Write
* Packed-Encoding: `E`
The 802.15.4 long address of this node.
This property is only present on NCPs which implement 802.15.4
### PROP 53: PROP_MAC_15_4_SADDR {#prop-mac-15-4-saddr}
* Type: Read-Write
* Packed-Encoding: `S`
The 802.15.4 short address of this node.
This property is only present on NCPs which implement 802.15.4
### PROP 54: PROP_MAC_15_4_PANID {#prop-mac-15-4-panid}
* Type: Read-Write
* Packed-Encoding: `S`
The 802.15.4 PANID this node is associated with.
This property is only present on NCPs which implement 802.15.4
### PROP 55: PROP_MAC_RAW_STREAM_ENABLED {#prop-mac-raw-stream-enabled}
* Type: Read-Write
* Packed-Encoding: `b`
Set to true to enable raw MAC frames to be emitted from `PROP_STREAM_RAW`.
See (#prop-stream-raw).
### PROP 56: PROP_MAC_PROMISCUOUS_MODE {#prop-mac-promiscuous-mode}
* Type: Read-Write
* Packed-Encoding: `C`
Possible Values:
Id | Name | Description
---|-------------------------------|------------------
0 | `MAC_PROMISCUOUS_MODE_OFF` | Normal MAC filtering is in place.
1 | `MAC_PROMISCUOUS_MODE_NETWORK`| All MAC packets matching network are passed up the stack.
2 | `MAC_PROMISCUOUS_MODE_FULL` | All decoded MAC packets are passed up the stack.
See (#prop-stream-raw).
### PROP 57: PROP_MAC_ENERGY_SCAN_RESULT {#prop-mac-escan-result}
* Type: Read-Only-Stream
* Packed-Encoding: `Cc`
This property is emitted during energy scan operation
per scanned channel with following format:
* `C`: Channel
* `c`: RSSI (in dBm)
### PROP 58: PROP_MAC_DATA_POLL_PERIOD {#prop-mac-data-poll-period
* Type: Read-Write
* Packed-Encoding: `L`
The (user-specified) data poll (802.15.4 MAC Data Request) period
in milliseconds. Value zero means there is no user-specified
poll period, and the network stack determines the maximum period
based on the MLE Child Timeout.
If the value is non-zero, it specifies the maximum period between
data poll transmissions. Note that the network stack may send data
request transmissions more frequently when expecting a control-message
(e.g., when waiting for an MLE Child ID Response).
This property is only present on NCPs which implement 802.15.4.
### PROP 4864: PROP_MAC_WHITELIST {#prop-mac-whitelist}
* Type: Read-Write
* Packed-Encoding: `A(T(Ec))`
* Required capability: `CAP_MAC_WHITELIST`
Structure Parameters:
* `E`: EUI64 address of node
* `c`: Optional RSSI-override value. The value 127 indicates
that the RSSI-override feature is not enabled for this
address. If this value is omitted when setting or
inserting, it is assumed to be 127. This parameter is
ignored when removing.
### PROP 4865: PROP_MAC_WHITELIST_ENABLED {#prop-mac-whitelist-enabled}
* Type: Read-Write
* Packed-Encoding: `b`
* Required capability: `CAP_MAC_WHITELIST`
### PROP 4867: SPINEL_PROP_MAC_SRC_MATCH_ENABLED {#prop-mac-src-match-enabled}
* Type: Write
* Packed-Encoding: `b`
Set to true to enable radio source matching or false to disable it. This property
is only available if the `SPINEL_CAP_MAC_RAW` capability is present. The source match
functionality is used by radios when generating ACKs. The short and extended address
lists are used for settings the Frame Pending bit in the ACKs.
### PROP 4868: SPINEL_PROP_MAC_SRC_MATCH_SHORT_ADDRESSES {#prop-mac-src-match-short-addresses}
* Type: Write
* Packed-Encoding: `A(S)`
Configures the list of short addresses used for source matching. This property
is only available if the `SPINEL_CAP_MAC_RAW` capability is present.
Structure Parameters:
* `S`: Short address for hardware generated ACKs
### PROP 4869: SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES {#prop-mac-src-match-extended-addresses}
* Type: Write
* Packed-Encoding: `A(E)`
Configures the list of extended addresses used for source matching. This property
is only available if the `SPINEL_CAP_MAC_RAW` capability is present.
Structure Parameters:
* `E`: EUI64 address for hardware generated ACKs
### PROP 4870: PROP_MAC_BLACKLIST {#prop-mac-blacklist}
* Type: Read-Write
* Packed-Encoding: `A(T(E))`
* Required capability: `CAP_MAC_WHITELIST`
Structure Parameters:
* `E`: EUI64 address of node
### PROP 4871: PROP_MAC_BLACKLIST_ENABLED {#prop-mac-blacklist-enabled}
* Type: Read-Write
* Packed-Encoding: `b`
* Required capability: `CAP_MAC_WHITELIST`
### PROP 4873: PROP_MAC_CCA_FAILURE_RATE {#prop-mac-cca-failure-rate}
* Type: Read Only
* Packed-Encoding: `S`
This property provides the current CCA (Clear Channel Assessment) failure rate.
Maximum value `0xffff` corresponding to 100% failure rate.
@@ -1,70 +0,0 @@
## NET Properties {#prop-net}
### PROP 64: PROP_NET_SAVED {#prop-net-saved}
* Type: Read-Only
* Packed-Encoding: `b`
Returns true if there is a network state stored/saved.
### PROP 65: PROP_NET_IF_UP {#prop-net-if-up}
* Type: Read-Write
* Packed-Encoding: `b`
Network interface up/down status. Non-zero (set to 1) indicates up,
zero indicates down.
### PROP 66: PROP_NET_STACK_UP {#prop-net-stack-up}
* Type: Read-Write
* Packed-Encoding: `b`
* Unit: Enumeration
Thread stack operational status. Non-zero (set to 1) indicates up,
zero indicates down.
### PROP 67: PROP_NET_ROLE {#prop-net-role}
* Type: Read-Write
* Packed-Encoding: `C`
* Unit: Enumeration
Values:
* 0: `NET_ROLE_DETACHED`
* 1: `NET_ROLE_CHILD`
* 2: `NET_ROLE_ROUTER`
* 3: `NET_ROLE_LEADER`
### PROP 68: PROP_NET_NETWORK_NAME {#prop-net-network-name}
* Type: Read-Write
* Packed-Encoding: `U`
### PROP 69: PROP_NET_XPANID {#prop-net-xpanid}
* Type: Read-Write
* Packed-Encoding: `D`
### PROP 70: PROP_NET_MASTER_KEY {#prop-net-master-key}
* Type: Read-Write
* Packed-Encoding: `D`
### PROP 71: PROP_NET_KEY_SEQUENCE_COUNTER {#prop-net-key-sequence-counter}
* Type: Read-Write
* Packed-Encoding: `L`
### PROP 72: PROP_NET_PARTITION_ID {#prop-net-partition-id}
* Type: Read-Write
* Packed-Encoding: `L`
The partition ID of the partition that this node is a member of.
### PROP 73: PROP_NET_REQUIRE_JOIN_EXISTING {#prop-net-require-join-existing}
* Type: Read-Write
* Packed-Encoding: `b`
### PROP 74: PROP_NET_KEY_SWITCH_GUARDTIME {#prop-net-key-swtich-guardtime}
* Type: Read-Write
* Packed-Encoding: `L`
### PROP 75: PROP_NET_PSKC {#prop-net-pskc}
* Type: Read-Write
* Packed-Encoding: `D`
@@ -1,69 +0,0 @@
Spinel is largely a property-based protocol, similar to representational state transfer (REST), with a property defined for every attribute that an OS needs to create, read, update or delete in the function of an IPv6 interface. The inspiration of this approach was memory-mapped hardware registers for peripherals. The goal is to avoid, as much as possible, the use of large complicated structures and/or method argument lists. The reason for avoiding these is because they have a tendency to change, especially early in development. Adding or removing a property from a structure can render the entire protocol incompatible. By using properties, you simply extend the protocol with an additional property.
Almost all features and capabilities are implemented using properties. Most new features that are initially proposed as commands can be adapted to be property-based instead. Notable exceptions include "Host Buffer Offload" ((#feature-host-buffer-offload)) and "Network Save" ((#feature-network-save)).
In Spinel, properties are keyed by an unsigned integer between 0 and 2,097,151 (See (#packed-unsigned-integer)).
## Property Methods ###
Properties may support one or more of the following methods:
* `VALUE_GET` ((#cmd-prop-value-get))
* `VALUE_SET` ((#cmd-prop-value-set))
* `VALUE_INSERT` ((#cmd-prop-value-insert))
* `VALUE_REMOVE` ((#cmd-prop-value-remove))
Additionally, the NCP can send updates to the host (either synchronously or asynchronously) that inform the host about changes to specific properties:
* `VALUE_IS` ((#cmd-prop-value-is))
* `VALUE_INSERTED` ((#cmd-prop-value-inserted))
* `VALUE_REMOVED` ((#cmd-prop-value-removed))
## Property Types ###
Conceptually, there are three different types of properties:
* Single-value properties
* Multiple-value (Array) properties
* Stream properties
### Single-Value Properties ####
Single-value properties are properties that have a simple representation of a single value. Examples would be:
* Current radio channel (Represented as an unsigned 8-bit integer)
* Network name (Represented as a UTF-8 encoded string)
* 802\.15.4 PAN ID (Represented as an unsigned 16-bit integer)
The valid operations on these sorts of properties are `GET` and `SET`.
### Multiple-Value Properties ####
Multiple-Value Properties have more than one value associated with them. Examples would be:
* List of channels supported by the radio hardware.
* List of IPv6 addresses assigned to the interface.
* List of capabilities supported by the NCP.
The valid operations on these sorts of properties are `VALUE_GET`, `VALUE_SET`, `VALUE_INSERT`, and `VALUE_REMOVE`.
When the value is fetched using `VALUE_GET`, the returned value is the concatenation of all of the individual values in the list. If the length of the value for an individual item in the list is not defined by the type then each item returned in the list is prepended with a length (See (#arrays)). The order of the returned items, unless explicitly defined for that specific property, is undefined.
`VALUE_SET` provides a way to completely replace all previous values. Calling `VALUE_SET` with an empty value effectively instructs the NCP to clear the value of that property.
`VALUE_INSERT` and `VALUE_REMOVE` provide mechanisms for the insertion or removal of individual items *by value*. The payload for these commands is a plain single value.
### Stream Properties ####
Stream properties are special properties representing streams of data. Examples would be:
* Network packet stream ((#prop-stream-net))
* Raw packet stream ((#prop-stream-raw))
* Debug message stream ((#prop-stream-debug))
* Network Beacon stream ((#prop-mac-scan-beacon))
All such properties emit changes asynchronously using the `VALUE_IS` command, sent from the NCP to the host. For example, as IPv6 traffic is received by the NCP, the IPv6 packets are sent to the host by way of asynchronous `VALUE_IS` notifications.
Some of these properties also support the host send data back to the NCP. For example, this is how the host sends IPv6 traffic to the NCP.
These types of properties generally do not support `VALUE_GET`, as it is meaningless.
@@ -1,72 +0,0 @@
## PHY Properties {#prop-phy}
### PROP 32: PROP_PHY_ENABLED {#prop-phy-enabled}
* Type: Read-Write
* Packed-Encoding: `b` (bool8)
Set to 1 if the PHY is enabled, set to 0 otherwise.
May be directly enabled to bypass higher-level packet processing
in order to implement things like packet sniffers. This property
can only be written if the `SPINEL_CAP_MAC_RAW` capability is present.
### PROP 33: PROP_PHY_CHAN {#prop-phy-chan}
* Type: Read-Write
* Packed-Encoding: `C` (uint8)
Value is the current channel. Must be set to one of the
values contained in `PROP_PHY_CHAN_SUPPORTED`.
### PROP 34: PROP_PHY_CHAN_SUPPORTED {#prop-phy-chan-supported}
* Type: Read-Only
* Packed-Encoding: `A(C)` (array of uint8)
* Unit: List of channels
Value is a list of channel values that are supported by the
hardware.
### PROP 35: PROP_PHY_FREQ {#prop-phy-freq}
* Type: Read-Only
* Packed-Encoding: `L` (uint32)
* Unit: Kilohertz
Value is the radio frequency (in kilohertz) of the
current channel.
### PROP 36: PROP_PHY_CCA_THRESHOLD {#prop-phy-cca-threshold}
* Type: Read-Write
* Packed-Encoding: `c` (int8)
* Unit: dBm
Value is the CCA (clear-channel assessment) threshold. Set to
-128 to disable.
When setting, the value will be rounded down to a value
that is supported by the underlying radio hardware.
### PROP 37: PROP_PHY_TX_POWER {#prop-phy-tx-power}
* Type: Read-Write
* Packed-Encoding: `c` (int8)
* Unit: dBm
Value is the transmit power of the radio.
When setting, the value will be rounded down to a value
that is supported by the underlying radio hardware.
### PROP 38: PROP_PHY_RSSI {#prop-phy-rssi}
* Type: Read-Only
* Packed-Encoding: `c` (int8)
* Unit: dBm
Value is the current RSSI (Received signal strength indication)
from the radio. This value can be used in energy scans and for
determining the ambient noise floor for the operating environment.
### PROP 39: PROP_PHY_RX_SENSITIVITY {#prop-phy-rx-sensitivity}
* Type: Read-Only
* Packed-Encoding: `c` (int8)
* Unit: dBm
Value is the radio receive sensitivity. This value can be used as
lower bound noise floor for link metrics computation.
-58
View File
@@ -1,58 +0,0 @@
# Properties
{{spinel-prop-overview.md}}
## Property Numbering
While the majority of the properties that allow the configuration
of network connectivity are network protocol specific, there are
several properties that are required in all implementations.
Future property allocations **SHALL** be made from the
following allocation plan:
Property ID Range | Description
:---------------------|:-----------------
0 - 127 | Reserved for frequently-used properties
128 - 15,359 | Unallocated
15,360 - 16,383 | Vendor-specific
16,384 - 1,999,999 | Unallocated
2,000,000 - 2,097,151 | Experimental use only
For an explanation of the data format encoding shorthand used
throughout this document, see (#data-packing).
## Property Sections
The currently assigned properties are broken up into several
sections, each with reserved ranges of property identifiers.
These ranges are:
Name | Range (Inclusive) | Documentation
-------|------------------------------|--------------
Core | 0x00 - 0x1F, 0x1000 - 0x11FF | (#prop-core)
PHY | 0x20 - 0x2F, 0x1200 - 0x12FF | (#prop-phy)
MAC | 0x30 - 0x3F, 0x1300 - 0x13FF | (#prop-mac)
NET | 0x40 - 0x4F, 0x1400 - 0x14FF | (#prop-net)
Tech | 0x50 - 0x5F, 0x1500 - 0x15FF | Technology-specific
IPv6 | 0x60 - 0x6F, 0x1600 - 0x16FF | (#prop-ipv6)
Stream | 0x70 - 0x7F, 0x1700 - 0x17FF | (#prop-core)
Debug | 0x4000 - 0x4400 | (#prop-debug)
Note that some of the property sections have two reserved
ranges: a primary range (which is encoded as a single byte)
and an extended range (which is encoded as two bytes).
properties which are used more frequently are generally
allocated from the former range.
{{spinel-prop-core.md}}
{{spinel-prop-phy.md}}
{{spinel-prop-mac.md}}
{{spinel-prop-net.md}}
{{spinel-prop-ipv6.md}}
{{spinel-prop-debug.md}}
@@ -1,9 +0,0 @@
# Security Considerations #
## Raw Application Access ##
Spinel **MAY** be used as an API boundary for allowing processes to configure
the NCP. However, such a system **MUST NOT** give unprivileged processess the
ability to send or receive arbitrary command frames to the NCP. Only the
specific commands and properties that are required should be allowed to be
passed, and then only after being checked for proper format.
@@ -1,66 +0,0 @@
# Status Codes
Status codes are sent from the NCP to the host via
`PROP_LAST_STATUS` using the `CMD_VALUE_IS` command to indicate
the return status of a previous command. As with any response,
the TID field of the FLAG byte is used to correlate the response
with the request.
Note that most successfully executed commands do not indicate
a last status of `STATUS_OK`. The usual way the NCP indicates a
successful command is to mirror the property change back to the
host. For example, if you do a `CMD_VALUE_SET` on `PROP_PHY_ENABLED`,
the NCP would indicate success by responding with a `CMD_VALUE_IS`
for `PROP_PHY_ENABLED`. If the command failed, `PROP_LAST_STATUS`
would be emitted instead.
See (#prop-last-status) for more information on `PROP_LAST_STATUS`.
* 0: `STATUS_OK`: Operation has completed successfully.
* 1: `STATUS_FAILURE`: Operation has failed for some undefined
reason.
* 2: `STATUS_UNIMPLEMENTED`: The given operation has not been implemented.
* 3: `STATUS_INVALID_ARGUMENT`: An argument to the given operation is invalid.
* 4: `STATUS_INVALID_STATE` : The given operation is invalid for the current
state of the device.
* 5: `STATUS_INVALID_COMMAND`: The given command is not recognized.
* 6: `STATUS_INVALID_INTERFACE`: The given Spinel interface is not supported.
* 7: `STATUS_INTERNAL_ERROR`: An internal runtime error has occurred.
* 8: `STATUS_SECURITY_ERROR`: A security or authentication error has occurred.
* 9: `STATUS_PARSE_ERROR`: An error has occurred while parsing the command.
* 10: `STATUS_IN_PROGRESS`: The operation is in progress and will be
completed asynchronously.
* 11: `STATUS_NOMEM`: The operation has been prevented due to memory
pressure.
* 12: `STATUS_BUSY`: The device is currently performing a mutually exclusive
operation.
* 13: `STATUS_PROP_NOT_FOUND`: The given property is not recognized.
* 14: `STATUS_PACKET_DROPPED`: The packet was dropped.
* 15: `STATUS_EMPTY`: The result of the operation is empty.
* 16: `STATUS_CMD_TOO_BIG`: The command was too large to fit in the internal
buffer.
* 17: `STATUS_NO_ACK`: The packet was not acknowledged.
* 18: `STATUS_CCA_FAILURE`: The packet was not sent due to a CCA failure.
* 19: `STATUS_ALREADY`: The operation is already in progress or
the property was already set to the given value.
* 20: `STATUS_ITEM_NOT_FOUND`: The given item could not be found in the property.
* 21: `STATUS_INVALID_COMMAND_FOR_PROP`: The given command cannot be performed
on this property.
* 22-111: RESERVED
* 112-127: Reset Causes
* 112: `STATUS_RESET_POWER_ON`
* 113: `STATUS_RESET_EXTERNAL`
* 114: `STATUS_RESET_SOFTWARE`
* 115: `STATUS_RESET_FAULT`
* 116: `STATUS_RESET_CRASH`
* 117: `STATUS_RESET_ASSERT`
* 118: `STATUS_RESET_OTHER`
* 119: `STATUS_RESET_UNKNOWN`
* 120: `STATUS_RESET_WATCHDOG`
* 121-127: RESERVED-RESET-CODES
* 128 - 15,359: UNALLOCATED
* 15,360 - 16,383: Vendor-specific
* 16,384 - 1,999,999: UNALLOCATED
* 2,000,000 - 2,097,151: Experimental Use Only (MUST NEVER be used
in production!)
@@ -1,578 +0,0 @@
# Technology: Thread(R) {#tech-thread}
This section describes all of the properties and semantics required
for managing a Thread(R) NCP.
Thread(R) NCPs have the following requirements:
* The property `PROP_INTERFACE_TYPE` must be 3.
* The non-optional properties in the following sections **MUST** be
implemented: CORE, PHY, MAC, NET, and IPV6.
All serious implementations of an NCP **SHOULD** also support the network
save feature (See (#feature-network-save)).
## Capabilities {#thread-caps}
The Thread(R) technology defines the following capabilities:
* `CAP_NET_THREAD_1_0` - Indicates that the NCP implements v1.0 of the Thread(R) standard.
* `CAP_NET_THREAD_1_1` - Indicates that the NCP implements v1.1 of the Thread(R) standard.
## Properties {#thread-properties}
Properties for Thread(R) are allocated out of the `Tech` property
section (see (#property-sections)).
### PROP 80: PROP_THREAD_LEADER_ADDR
* Type: Read-Only
* Packed-Encoding: `6`
The IPv6 address of the leader. (Note: May change to long and short address of leader)
### PROP 81: PROP_THREAD_PARENT
* Type: Read-Only
* Packed-Encoding: `ES`
* LADDR, SADDR
The long address and short address of the parent of this node.
### PROP 82: PROP_THREAD_CHILD_TABLE
* Type: Read-Only
* Packed-Encoding: `A(t(ESLLCCcCc)`
Table containing info about all the children of this node.
Data per item is:
* `E`: Extended address
* `S`: RLOC16
* `L`: Timeout (in seconds)
* `L`: Age (in seconds)
* `L`: Network Data version
* `C`: Link Quality In
* `c`: Average RSS (in dBm)
* `C`: Mode (bit-flags)
* `c`: Last RSSI (in dBm)
### PROP 83: PROP_THREAD_LEADER_RID
* Type: Read-Only
* Packed-Encoding: `C`
The router-id of the current leader.
### PROP 84: PROP_THREAD_LEADER_WEIGHT
* Type: Read-Only
* Packed-Encoding: `C`
The leader weight of the current leader.
### PROP 85: PROP_THREAD_LOCAL_LEADER_WEIGHT
* Type: Read-Write
* Packed-Encoding: `C`
The leader weight for this node.
### PROP 86: PROP_THREAD_NETWORK_DATA
* Type: Read-Only
* Packed-Encoding: `D`
The local network data.
### PROP 87: PROP_THREAD_NETWORK_DATA_VERSION
* Type: Read-Only
* Packed-Encoding: `S`
### PROP 88: PROP_THREAD_STABLE_NETWORK_DATA
* Type: Read-Only
* Packed-Encoding: `D`
The local stable network data.
### PROP 89: PROP_THREAD_STABLE_NETWORK_DATA_VERSION
* Type: Read-Only
* Packed-Encoding: `S`
### PROP 90: PROP_THREAD_ON_MESH_NETS
* Type: Read-Write
* Packed-Encoding: `A(t(6CbCbS))`
Data per item is:
* `6`: IPv6 Prefix
* `C`: Prefix length in bits
* `b`: Stable flag
* `C`: TLV flags
* `b`: "Is defined locally" flag. Set if this network was locally
defined. Assumed to be true for set, insert and replace. Clear if
the on mesh network was defined by another node.
* `S`: The RLOC16 of the device that registered this on-mesh prefix entry.
This value is not used and ignored when adding an on-mesh prefix.
### PROP 91: PROP_THREAD_OFF_MESH_ROUTES
* Type: Read-Write
* Packed-Encoding: `A(t(6CbCbb))`
Data per item is:
* `6`: Route Prefix
* `C`: Prefix length in bits
* `b`: Stable flag
* `C`: Route preference flags
* `b`: "Is defined locally" flag. Set if this route info was locally
defined as part of local network data. Assumed to be true for set,
insert and replace. Clear if the route is part of partition's network
data.
* `b`: "Next hop is this device" flag. Set if the next hop for the
route is this device itself (i.e., route was added by this device)
This value is ignored when adding an external route. For any added
route the next hop is this device.
* `S`: The RLOC16 of the device that registered this route entry.
This value is not used and ignored when adding a route.
### PROP 92: PROP_THREAD_ASSISTING_PORTS
* Type: Read-Write
* Packed-Encoding: `A(S)`
### PROP 93: PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE
* Type: Read-Write
* Packed-Encoding: `b`
Set to true before changing local net data. Set to false when finished.
This allows changes to be aggregated into single events.
### PROP 94: PROP_THREAD_MODE
* Type: Read-Write
* Packed-Encoding: `C`
This property contains the value of the mode
TLV for this node. The meaning of the bits in this
bitfield are defined by section 4.5.2 of the Thread(R)
specification.
### PROP 5376: PROP_THREAD_CHILD_TIMEOUT
* Type: Read-Write
* Packed-Encoding: `L`
Used when operating in the Child role.
### PROP 5377: PROP_THREAD_RLOC16
* Type: Read-Write
* Packed-Encoding: `S`
### PROP 5378: PROP_THREAD_ROUTER_UPGRADE_THRESHOLD
* Type: Read-Write
* Packed-Encoding: `C`
### PROP 5379: PROP_THREAD_CONTEXT_REUSE_DELAY
* Type: Read-Write
* Packed-Encoding: `L`
### PROP 5380: PROP_THREAD_NETWORK_ID_TIMEOUT
* Type: Read-Write
* Packed-Encoding: `C`
Allows you to get or set the Thread(R) `NETWORK_ID_TIMEOUT` constant, as
defined by the Thread(R) specification.
### PROP 5381: PROP_THREAD_ACTIVE_ROUTER_IDS
* Type: Read-Write/Write-Only
* Packed-Encoding: `A(C)` (List of active thread router ids)
Note that some implementations may not support `CMD_GET_VALUE`
router ids, but may support `CMD_REMOVE_VALUE` when the node is
a leader.
### PROP 5382: PROP_THREAD_RLOC16_DEBUG_PASSTHRU
* Type: Read-Write
* Packed-Encoding: `b`
Allow the HOST to directly observe all IPv6 packets received by the NCP,
including ones sent to the RLOC16 address.
Default value is `false`.
### PROP 5383: PROP_THREAD_ROUTER_ROLE_ENABLED
* Type: Read-Write
* Packed-Encoding: `b`
Allow the HOST to indicate whether or not the router role is enabled.
If current role is a router, setting this property to `false` starts
a re-attach process as an end-device.
### PROP 5384: PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD
* Type: Read-Write
* Packed-Encoding: `C`
### PROP 5385: PROP_THREAD_ROUTER_SELECTION_JITTER
* Type: Read-Write
* Packed-Encoding: `C`
Specifies the self imposed random delay in seconds a REED waits before
registering to become an Active Router.
### PROP 5386: PROP_THREAD_PREFERRED_ROUTER_ID
* Type: Write-Only
* Packed-Encoding: `C`
Specifies the preferred Router Id. Upon becoming a router/leader the node
attempts to use this Router Id. If the preferred Router Id is not set or
if it can not be used, a randomly generated router id is picked. This
property can be set only when the device role is either detached or
disabled.
### PROP 5387: PROP_THREAD_NEIGHBOR_TABLE
* Type: Read-Only
* Packed-Encoding: `A(t(ESLCcCbLLc))`
Data per item is:
* `E`: Extended address
* `S`: RLOC16
* `L`: Age
* `C`: Link Quality In
* `c`: Average RSS (in dBm)
* `C`: Mode (bit-flags)
* `b`: `true` if neighbor is a child, `false` otherwise.
* `L`: Link Frame Counter
* `L`: MLE Frame Counter
* `c`: The last RSSI (in dBm)
### PROP 5388: PROP_THREAD_CHILD_COUNT_MAX
* Type: Read-Write
* Packed-Encoding: `C`
Specifies the maximum number of children currently allowed.
This parameter can only be set when Thread(R) protocol operation
has been stopped.
### PROP 5389: PROP_THREAD_LEADER_NETWORK_DATA
* Type: Read-Only
* Packed-Encoding: `D`
The leader network data.
### PROP 5390: PROP_THREAD_STABLE_LEADER_NETWORK_DATA
* Type: Read-Only
* Packed-Encoding: `D`
The stable leader network data.
### PROP 5391: PROP_THREAD_JOINERS {#prop-thread-joiners}
* Type: Insert/Remove Only (optionally Read-Write)
* Packed-Encoding: `A(t(ULE))`
* Required capability: `CAP_THREAD_COMMISSIONER`
Data per item is:
* `U`: PSKd
* `L`: Timeout in seconds
* `E`: IEEE EUI-64 (optional)
Passess Pre-Shared Key for the Device to the NCP in the commissioning process.
When the Extended address is ommited all Devices which provided a valid PSKd
are allowed to join the Thread(R) Network.
### PROP 5392: PROP_THREAD_COMMISSIONER_ENABLED {#prop-thread-commissioner-enabled}
* Type: Write only (optionally Read-Write)
* Packed-Encoding: `b`
* Required capability: `CAP_THREAD_COMMISSIONER`
Set to true to enable the native commissioner. It is mandatory before adding the joiner to the network.
### PROP 5393: PROP_THREAD_TMF_PROXY_ENABLED {#prop-thread-tmf-proxy-enabled}
* Type: Read-Write
* Packed-Encoding: `b`
* Required capability: `CAP_THREAD_TMF_PROXY`
Set to true to enable the TMF proxy.
### PROP 5394: PROP_THREAD_TMF_PROXY_STREAM {#prop-thread-tmf-proxy-stream}
* Type: Read-Write-Stream
* Packed-Encoding: `dSS`
* Required capability: `CAP_THREAD_TMF_PROXY`
Data per item is:
* `d`: CoAP frame
* `S`: source/destination RLOC/ALOC
* `S`: source/destination port
Octects: | 2 | *n* | 2 | 2
---------|--------|------|---------|-------
Fields: | Length | CoAP | locator | port
This property allows the host to send and receive TMF messages from
the NCP's RLOC address and support Thread-specific border router functions.
### PROP 5395: PROP_THREAD_DISOVERY_SCAN_JOINER_FLAG {#prop-thread-discovery-scan-joiner-flag}
* Type: Read-Write
* Packed-Encoding:: `b`
This property specifies the value used in Thread(R) MLE Discovery Request
TLV during discovery scan operation. Default value is `false`.
### PROP 5396: PROP_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING {#prop-thread-discovery-scan-enable-filtering}
* Type: Read-Write
* Packed-Encoding:: `b`
This property is used to enable/disable EUI64 filtering during discovery
scan operation. Default value is `false`.
### PROP 5397: PROP_THREAD_DISCOVERY_SCAN_PANID {#prop-thread-discovery-scan-panid}
* Type: Read-write
* Packed-Encoding:: `S`
This property specifies the PANID used for filtering during discovery
scan operation. Default value is `0xffff` (broadcast PANID) which disables
PANID filtering.
### PROP 5398: PROP_THREAD_STEERING_DATA {#prop-thread-steering-data}
* Type: Write-Only
* Packed-Encoding: `E`
* Required capability: `CAP_OOB_STEERING_DATA`
This property can be used to set the steering data for MLE Discovery
Response messages.
* All zeros to clear the steering data (indicating no steering data).
* All 0xFFs to set the steering data (bloom filter) to accept/allow all.
* A specific EUI64 which is then added to steering data/bloom filter.
### PROP 5399: SPINEL_PROP_THREAD_ROUTER_TABLE {#prop-thread-router-table}
* Type: Read-Only
* Packed-Encoding: `A(t(ESCCCCCCb)`
Data per item is:
* `E`: IEEE 802.15.4 Extended Address
* `S`: RLOC16
* `C`: Router ID
* `C`: Next hop to router
* `C`: Path cost to router
* `C`: Link Quality In
* `C`: Link Quality Out
* `C`: Age (seconds since last heard)
* `b`: Link established with Router ID or not.
### PROP 5400: SPINEL_PROP_THREAD_ACTIVE_DATASET (#prop-thread-active-dataset)
* Type: Read-Write
* Packing-Encoding: `A(t(iD))`
This property provides access to current Thread Active Operational Dataset.
A Thread device maintains the Operational Dataset that it has stored locally
and the one currently in use by the partition to which it is attached. This
property corresponds to the locally stored Dataset on the device.
Operational Dataset consists of a set of supported properties (e.g., channel,
master key, network name, PAN id, etc). Note that not all supported properties
may be present (have a value) in a Dataset.
The Dataset value is encoded as an array of structures containing pairs of
property key (as `i`) followed by the property value (as `D`). The property
value must follow the format associated with the corresponding spinel
property.
On write, any unknown/unsupported property keys must be ignored.
The following properties can be included in a Dataset list:
* SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP
* SPINEL_PROP_PHY_CHAN
* SPINEL_PROP_PHY_CHAN_SUPPORTED (Channel Mask Page 0)
* SPINEL_PROP_NET_MASTER_KEY
* SPINEL_PROP_NET_NETWORK_NAME
* SPINEL_PROP_NET_XPANID
* SPINEL_PROP_MAC_15_4_PANID
* SPINEL_PROP_IPV6_ML_PREFIX
* SPINEL_PROP_NET_PSKC
* SPINEL_PROP_DATASET_SECURITY_POLICY
### PROP 5401: SPINEL_PROP_THREAD_PENDING_DATASET (#prop-thread-pending-dataset)
* Type: Read-Write
* Packing-Encoding: `A(t(iD))`
This property provide access to current Thread Pending Operational Dataset
locally stored on the device.
The formatting of this property follows the same rules as in
SPINEL_PROP_THREAD_ACTIVE_DATASET.
In addition supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the
following properties can also be included in the Pending Dataset:
* SPINEL_PROP_DATASET_PENDING_TIMESTAMP
* SPINEL_PROP_DATASET_DELAY_TIMER
### PROP 5402: SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET (#prop-thread-mgmt-active-dataset)
* Type: Write only
* Packing-Encoding: `A(t(iD))`
The formatting of this property follows the same rules as in
SPINEL_PROP_THREAD_ACTIVE_DATASET.
This is write-only property. When written, it triggers a MGMT_ACTIVE_SET meshcop
command to be sent to the leader with the given Dataset. The spinel frame response
should be a `LAST_STATUS` with the status of the transmission of MGMT_ACTIVE_SET
command.
In addition to supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the
following property can be included in the Dataset (to allow for custom raw
TLVs):
* SPINEL_PROP_DATASET_RAW_TLVS
### PROP 5403: SPINEL_PROP_THREAD_MGMT_PENDING_DATASET (#prop-thread-mgmt-pending-dataset)
* Type: Write only
* Packing-Encoding: `A(t(iD))`
This property is similar to SPINEL_PROP_THREAD_PENDING_DATASET and follows the
same format and rules.
In addition to supported properties in SPINEL_PROP_THREAD_PENDING_DATASET, the
following property can be included the Dataset (to allow for custom raw TLVs to
be provided):
* SPINEL_PROP_DATASET_RAW_TLVS
### PROP 5404: SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP (#prop-dataset-active-timestamps)
* Type: No direct read or write
* Packing-Encoding: `X`
This property represents the Active Timestamp field in a Thread Operational
Dataset.
This can only be included in one of the Dataset related properties below:
* SPINEL_PROP_THREAD_ACTIVE_DATASET
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
### PROP 5405: SPINEL_PROP_DATASET_PENDING_TIMESTAMP (#prop-dataset-pending-timestamps)
* Type: No direct read or write
* Packing-Encoding: `X`
This property represents the Pending Timestamp field in a Thread Operational
Dataset.
It can only be included in one of the Pending Dataset properties:
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
### PROP 5406: SPINEL_PROP_DATASET_DELAY_TIMER (#prop-dataset-delay-timer)
* Type: No direct read or write
* Packing-Encoding: `L`
This property represents the Delay Timer field in a Thread Operational Dataset.
Delay timer (in ms) specifies the time renaming until Thread devices overwrite
the value in the Active Operational Dataset with the corresponding values in the
Pending Operational Dataset.
It can only be included in one of the Pending Dataset properties:
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
### PROP 5407: SPINEL_PROP_DATASET_SECURITY_POLICY (#prop-dataset-security-policy)
* Type: No direct read or write
* Packing-Encoding: `SC`
This property represents the Security Policy field in a Thread Operational
Dataset.
The content is:
* `S` : Key Rotation Time (in units of hour)
* `C` : Security Policy Flags (as specified in Thread 1.1 Section 8.10.1.15)
It can only be included in one of the Dataset related properties below:
* SPINEL_PROP_THREAD_ACTIVE_DATASET
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
### PROP 5408: SPINEL_PROP_DATASET_RAW_TLVS (#prop-dataset-raw-tlvs)
* Type: No direct read or write
* Packing-Encoding: `D`
This property defines extra raw TLVs that can be added to an Operational
DataSet.
It can only be included in one of the following Dataset properties:
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
### PROP 5409: SPINEL_PROP_THREAD_CHILD_TABLE_ADDRESSES (#prop-thread-child-table-addresses)
* Type: Read-Only
* Packing-Encoding: `A(t(ESA(6))`
This property provides the list of all addresses associated with every child
including any registered IPv6 addresses.
Data per item is:
* `E`: Extended address of the child
* `S`: RLOC16 of the child
* `A(6)`: List of IPv6 addresses registered by the child (if any)
### PROP 5410: SPINEL_PROP_THREAD_NEIGHBOR_TABLE_ERROR_RATES (#prop-thread-neighbor-table-error-rates)
* Type: Read-Only
* Packing-Encoding: `A(t(ESSScc))`
* Required capability: `CAP_ERROR_RATE_TRACKING`
This property provides link quality related info including
frame and (IPv6) message error rates for all neighbors.
With regards to message error rate, note that a larger (IPv6)
message can be fragmented and sent as multiple MAC frames. The
message transmission is considered a failure, if any of its
fragments fail after all MAC retry attempts.
Data per item is:
* `E`: Extended address of the neighbor
* `S`: RLOC16 of the neighbor
* `S`: Frame error rate (0 -> 0%, 0xffff -> 100%)
* `S`: Message error rate (0 -> 0%, 0xffff -> 100%)
* `c`: Average RSSI (in dBm)
* `c`: Last RSSI (in dBm)
### PROP 5411: SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE (#prop-thread-address-cache-table)
* Type: Read-Only
* Packing-Encoding: `A(t(6SC))`
This property provides Thread EID IPv6 address cache table.
Data per item is:
* `6` : Target IPv6 address
* `S` : RLOC16 of target
* `C` : Age (order of use, 0 indicates most recently used entry)
@@ -1,174 +0,0 @@
# Test Vectors
## Test Vector: Packed Unsigned Integer
Decimal Value | Packet Octet Encoding
-------------:|:----------------------
0 | `00`
1 | `01`
127 | `7F`
128 | `80 01`
129 | `81 01`
1,337 | `B9 0A`
16,383 | `FF 7F`
16,384 | `80 80 01`
16,385 | `81 80 01`
2,097,151 | `FF FF 7F`
<!-- RQ -- The PUI test-vector encodings need to be verified. -->
## Test Vector: Reset Command
* NLI: 0
* TID: 0
* CMD: 1 (`CMD_RESET`)
Frame:
80 01
## Test Vector: Reset Notification
* NLI: 0
* TID: 0
* CMD: 6 (`CMD_VALUE_IS`)
* PROP: 0 (`PROP_LAST_STATUS`)
* VALUE: 114 (`STATUS_RESET_SOFTWARE`)
Frame:
80 06 00 72
## Test Vector: Scan Beacon
* NLI: 0
* TID: 0
* CMD: 7 (`CMD_VALUE_INSERTED`)
* PROP: 51 (`PROP_MAC_SCAN_BEACON`)
* VALUE: Structure, encoded as `Cct(ESSc)t(iCUd)`
* CHAN: 15
* RSSI: -60dBm
* MAC_DATA: (0D 00 B6 40 D4 8C E9 38 F9 52 FF FF D2 04 00)
* Long address: B6:40:D4:8C:E9:38:F9:52
* Short address: 0xFFFF
* PAN-ID: 0x04D2
* LQI: 0
* NET_DATA: (13 00 03 20 73 70 69 6E 65 6C 00 08 00 DE AD 00 BE EF 00 CA FE)
* Protocol Number: 3
* Flags: 0x20
* Network Name: `spinel`
* XPANID: `DE AD 00 BE EF 00 CA FE`
Frame:
80 07 33 0F C4 0D 00 B6 40 D4 8C E9 38 F9 52 FF FF D2 04 00
13 00 03 20 73 70 69 6E 65 6C 00 08 00 DE AD 00 BE EF 00 CA
FE
## Test Vector: Inbound IPv6 Packet
CMD_VALUE_IS(PROP_STREAM_NET)
<!-- RQ -- FIXME: This test vector is incomplete. -->
## Test Vector: Outbound IPv6 Packet
CMD_VALUE_SET(PROP_STREAM_NET)
<!-- RQ -- FIXME: This test vector is incomplete. -->
## Test Vector: Fetch list of on-mesh networks
* NLI: 0
* TID: 4
* CMD: 2 (`CMD_VALUE_GET`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
Frame:
84 02 5A
## Test Vector: Returned list of on-mesh networks
* NLI: 0
* TID: 4
* CMD: 6 (`CMD_VALUE_IS`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
* VALUE: Array of structures, encoded as `A(t(6CbC))`
IPv6 Prefix | Prefix Length | Stable Flag | Other Flags
-------------|---------------|-------------|--------------
2001:DB8:1:: | 64 | True | ??
2001:DB8:2:: | 64 | False | ??
Frame:
84 06 5A 13 00 20 01 0D B8 00 01 00 00 00 00 00 00 00 00 00
00 40 01 ?? 13 00 20 01 0D B8 00 02 00 00 00 00 00 00 00 00
00 00 40 00 ??
<!-- TODO: This test vector is incomplete. -->
## Test Vector: Adding an on-mesh network
* NLI: 0
* TID: 5
* CMD: 4 (`CMD_VALUE_INSERT`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
* VALUE: Structure, encoded as `6CbCb`
IPv6 Prefix | Prefix Length | Stable Flag | Other Flags
-------------|---------------|-------------|--------------
2001:DB8:3:: | 64 | True | ??
Frame:
85 03 5A 20 01 0D B8 00 03 00 00 00 00 00 00 00 00 00 00 40
01 ?? 01
<!-- RQ -- FIXME: This test vector is incomplete. -->
## Test Vector: Insertion notification of an on-mesh network
* NLI: 0
* TID: 5
* CMD: 7 (`CMD_VALUE_INSERTED`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
* VALUE: Structure, encoded as `6CbCb`
IPv6 Prefix | Prefix Length | Stable Flag | Other Flags
-------------|---------------|-------------|--------------
2001:DB8:3:: | 64 | True | ??
Frame:
85 07 5A 20 01 0D B8 00 03 00 00 00 00 00 00 00 00 00 00 40
01 ?? 01
<!-- RQ -- FIXME: This test vector is incomplete. -->
## Test Vector: Removing a local on-mesh network
* NLI: 0
* TID: 6
* CMD: 5 (`CMD_VALUE_REMOVE`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
* VALUE: IPv6 Prefix `2001:DB8:3::`
Frame:
86 05 5A 20 01 0D B8 00 03 00 00 00 00 00 00 00 00 00 00
## Test Vector: Removal notification of an on-mesh network
* NLI: 0
* TID: 6
* CMD: 8 (`CMD_VALUE_REMOVED`)
* PROP: 90 (`PROP_THREAD_ON_MESH_NETS`)
* VALUE: IPv6 Prefix `2001:DB8:3::`
Frame:
86 08 5A 20 01 0D B8 00 03 00 00 00 00 00 00 00 00 00 00
+53
View File
@@ -0,0 +1,53 @@
#
# 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.
#
# 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" "external")
set(platforms_dir "${PROJECT_SOURCE_DIR}/examples/platforms")
file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*")
foreach(platform IN LISTS platforms)
if(IS_DIRECTORY "${platforms_dir}/${platform}")
list(APPEND result "${platform}")
endif()
endforeach()
list(REMOVE_ITEM result utils)
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()
+408
View File
@@ -0,0 +1,408 @@
#
# 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.
#
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")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
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")
if(OT_BORDER_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1")
endif()
option(OT_BORDER_ROUTER "enable border router support")
if(OT_BORDER_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
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")
else()
set(OT_MBEDTLS ${OT_EXTERNAL_MBEDTLS})
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0")
endif()
option(OT_BUILTIN_MBEDTLS_MANAGEMENT "enable builtin mbedtls management" ON)
if(OT_BUILTIN_MBEDTLS_MANAGEMENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
endif()
option(OT_CHANNEL_MANAGER "enable channel manager support")
if(OT_CHANNEL_MANAGER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1")
endif()
option(OT_CHANNEL_MONITOR "enable channel monitor support")
if(OT_CHANNEL_MONITOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1")
endif()
option(OT_CHILD_SUPERVISION "enable child supervision support")
if(OT_CHILD_SUPERVISION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1")
endif()
option(OT_COAP "enable coap api support")
if(OT_COAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_API_ENABLE=1")
endif()
option(OT_COAPS "enable secure coap api support")
if(OT_COAPS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1")
endif()
option(OT_COAP_BLOCK "enable coap block-wise transfer (RFC7959) api support")
if(OT_COAP_BLOCK)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1")
endif()
option(OT_COAP_OBSERVE "enable coap observe (RFC7641) api support")
if(OT_COAP_OBSERVE)
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1")
endif()
option(OT_COMMISSIONER "enable commissioner support")
if(OT_COMMISSIONER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1")
endif()
option(OT_CSL_RECEIVER "enable csl receiver")
if(OT_CSL_RECEIVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1")
endif()
option(OT_CSL_AUTO_SYNC "enable data polling based on csl config" ${OT_CSL_RECEIVER})
if(OT_CSL_AUTO_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0")
endif()
option(OT_CSL_DEBUG "enable csl debug")
if(OT_CSL_DEBUG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1")
endif()
option(OT_DATASET_UPDATER "enable dataset updater support")
if(OT_DATASET_UPDATER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1")
endif()
option(OT_DHCP6_CLIENT "enable DHCP6 client support")
if(OT_DHCP6_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1")
endif()
option(OT_DHCP6_SERVER "enable DHCP6 server support")
if(OT_DHCP6_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1")
endif()
option(OT_DIAGNOSTIC "enable diagnostic support")
if(OT_DIAGNOSTIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DIAG_ENABLE=1")
endif()
option(OT_DNS_CLIENT "enable DNS client support")
if(OT_DNS_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1")
endif()
option(OT_DNS_DSO "enable DNS Stateful Operations (DSO) support")
if(OT_DNS_DSO)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_DSO_ENABLE=1")
endif()
option(OT_DNSSD_SERVER "enable DNS-SD server support")
if(OT_DNSSD_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1")
endif()
option(OT_DOC "Build OpenThread documentation")
option(OT_ECDSA "enable ECDSA support")
if(OT_ECDSA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ECDSA_ENABLE=1")
endif()
option(OT_SRP_CLIENT "enable SRP client support")
if (OT_SRP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1")
endif()
option(OT_DUA "enable Domain Unicast Address feature for Thread 1.2")
if(OT_DUA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DUA_ENABLE=1")
endif()
option(OT_MESSAGE_USE_HEAP "enable heap allocator for message buffers")
if(OT_MESSAGE_USE_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1")
endif()
option(OT_MLR "enable Multicast Listener Registration feature for Thread 1.2")
if(OT_MLR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLR_ENABLE=1")
endif()
option(OT_EXTERNAL_HEAP "enable external heap support")
if(OT_EXTERNAL_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1")
endif()
option(OT_HISTORY_TRACKER "enable history tracker support")
if(OT_HISTORY_TRACKER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1")
endif()
option(OT_IP6_FRAGM "enable ipv6 fragmentation support")
if(OT_IP6_FRAGM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1")
endif()
option(OT_JAM_DETECTION "enable jam detection support")
if(OT_JAM_DETECTION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1")
endif()
option(OT_JOINER "enable joiner support")
if(OT_JOINER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JOINER_ENABLE=1")
endif()
option(OT_LEGACY "enable legacy network support")
if(OT_LEGACY)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LEGACY_ENABLE=1")
endif()
option(OT_LINK_RAW "enable link raw service")
if(OT_LINK_RAW)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1")
endif()
option(OT_LINK_METRICS_INITIATOR "enable link metrics initiator")
if (OT_LINK_METRICS_INITIATOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1")
endif()
option(OT_LINK_METRICS_SUBJECT "enable link metrics subject")
if (OT_LINK_METRICS_SUBJECT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1")
endif()
option(OT_LOG_LEVEL_DYNAMIC "enable dynamic log level control")
if(OT_LOG_LEVEL_DYNAMIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1")
endif()
option(OT_MAC_FILTER "enable mac filter support")
if(OT_MAC_FILTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1")
endif()
option(OT_MLE_LONG_ROUTES "enable MLE long routes extension (experimental, breaks Thread conformance)")
if(OT_MLE_LONG_ROUTES)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1")
endif()
option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
if(OT_MTD_NETDIAG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
endif()
option(OT_MULTIPLE_INSTANCE "enable multiple instances")
if(OT_MULTIPLE_INSTANCE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1")
endif()
option(OT_NEIGHBOR_DISCOVERY_AGENT "enable neighbor discovery agent support")
if(OT_NEIGHBOR_DISCOVERY_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1")
endif()
option(OT_NETDATA_PUBLISHER "enable Thread Network Data publisher")
if(OT_NETDATA_PUBLISHER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1")
endif()
option(OT_PING_SENDER "enable ping sender support" ${OT_APP_CLI})
if(OT_PING_SENDER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1")
endif()
option(OT_PLATFORM_NETIF "enable platform netif support")
if(OT_PLATFORM_NETIF)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1")
endif()
option(OT_PLATFORM_UDP "enable platform UDP support")
if(OT_PLATFORM_UDP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1")
endif()
if(OT_POSIX_SETTINGS_PATH)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
endif()
option(OT_REFERENCE_DEVICE "enable Thread Test Harness reference device support")
if(OT_REFERENCE_DEVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1")
endif()
option(OT_SERVICE "enable support for injecting Service entries into the Thread Network Data")
if(OT_SERVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1")
endif()
option(OT_SETTINGS_RAM "enable volatile-only storage of settings")
if(OT_SETTINGS_RAM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SETTINGS_RAM=1")
endif()
option(OT_SLAAC "enable support for adding of auto-configured SLAAC addresses by OpenThread")
if(OT_SLAAC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1")
endif()
option(OT_SNTP_CLIENT "enable SNTP Client support")
if(OT_SNTP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1")
endif()
option(OT_SRP_SERVER "enable SRP server")
if (OT_SRP_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1")
endif()
option(OT_TIME_SYNC "enable the time synchronization service feature")
if(OT_TIME_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1")
endif()
option(OT_TREL "enable TREL radio link for Thread over Infrastructure feature")
if (OT_TREL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1")
endif()
option(OT_TX_BEACON_PAYLOAD "enable Thread beacon payload in outgoing beacons")
if (OT_TX_BEACON_PAYLOAD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE=1")
endif()
option(OT_UDP_FORWARD "enable UDP forward support")
if(OT_UDP_FORWARD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1")
endif()
option(OT_UPTIME "enable support for tracking OpenThread instance's uptime")
if(OT_UPTIME)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UPTIME_ENABLE=1")
endif()
option(OT_FIREWALL "enable firewall")
if (OT_FIREWALL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1")
endif()
option(OT_FULL_LOGS "enable full logs")
if(OT_FULL_LOGS)
if(NOT OT_LOG_LEVEL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
endif()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
option(OT_OTNS "enable OTNS support")
if(OT_OTNS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_OTNS_ENABLE=1")
endif()
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
else()
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
endif()
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
# Checks
if(OT_PLATFORM_UDP AND OT_UDP_FORWARD)
message(FATAL_ERROR "OT_PLATFORM_UDP and OT_UDP_FORWARD are exclusive")
endif()

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