Commit Graph

4693 Commits

Author SHA1 Message Date
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.
thread-reference-20200818
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