Commit Graph

990 Commits

Author SHA1 Message Date
jinran-google e66c21c3da [api] include Thread version in neighbor info (#8435) 2022-11-23 21:34:13 -08:00
whd 9f702782bd [telemetry] implement RA/RS counters (#8416) 2022-11-22 09:23:58 -08:00
Zhanglong Xia 5e9c7d914d [spinel] update the updating/adding RCP spinel property guideline (#7937)
When adding a new spinel property or updating the existing spinel
property, it may cause the host can't work with the old RCP. The
host can be updated independently on some of our products. If the
compatibility issue happens, it causes the host dies after the
host is updated.

To reduce the compatibility issues between the host and RCP, this
commit updates the guideline of updating/adding RCP spinel properties.
2022-11-21 08:52:56 -08:00
Zhanglong Xia 3e138d3f5d [diag] add gpio mode commands (#8391)
This commit adds diag commands for setting the GPIO mode to resolve
the conflict https://github.com/openthread/openthread/issues/8362.
2022-11-12 04:51:24 +01:00
whd 8045c829d7 [cli] add commands for Border Routing counters (#8372) 2022-11-09 11:31:11 +01:00
whd df20f3d91a [telemetry] border routing packet counters (#8280)
This commit introduces `otBorderRoutingCounters` which contains the
number of packets and bytes forwarded via border routing.

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

I've verified this feature locally on a BR device by ping command in
following scenarios:
- A host pings an ED's OMR.
- An ED pings a host's onlink address.
- A host pings a multicast address which an ED subscribes to.
- An ED pings a multicast address which a host subscribes to.
2022-11-04 00:13:10 -07:00
andrei-menzopol a532ce6e57 [crypto] add ECDSA API (#8273)
- remove ecdsa tinycrypt implementation
- add crypto API, move default implementation in crypto_platform.c
- define crypto ecdsa structures and format
2022-11-03 09:40:51 -07:00
Abtin Keshavarzian f5367f6238 [log] add arg format check to otLog{Level}Plat() functions (#8356) 2022-11-02 22:45:05 -07:00
Zhanglong Xia 11a24d111f [diag] add gpio diag command support (#8316) 2022-10-31 17:05:20 -07:00
Abtin Keshavarzian ca8799a4b8 [routing-manager] persist deprecating old prefixes in Settings (#8330)
This commit adds mechanism to save deprecating old on-link prefixes
in non-volatile `Settings`. With this, if the BR is restarted, it
will remember the old prefixes and keep deprecating them (advertising
them in emitted RA and publish them in Thread Network Data).

This commit also adds `TestSavedOnLinkPrefixes()` test case in
`test_routing_manager` to cover the behavior of the newly added
mechanism.
2022-10-27 15:12:59 -07:00
Abtin Keshavarzian 53305d4762 [routing-manager] add Neighbor Solicit probe mechanism (#8090)
This commit adds a new mechanism in `RoutingManager` to periodically
check that discovered routers are still active and operational, so
that if the router providing the favored on-link prefix becomes
offline, we can detect it more quickly (instead of waiting for the
prefix lifetime to expire) and then the BR can start advertising its
own on-link prefix.

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

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

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

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

The commit uses the new macro in `String::Append()` and its uses are
updated to ensure consistency between format string and the args.
2022-10-21 16:26:21 -07:00
Song GUO aae250af89 [nat64] add runtime switch for NAT64 prefix publisher and translator (#8194) 2022-10-18 14:42:25 -07:00
Sarah 992f9c6374 [docs] Doxygen formatting updates (#8286)
For various reasons, we're not able to use `<` and `>` in our Doxygen
descriptions. I made some minor edits, LMKWYT. In the HTML, it renders
similar to this:

The IPv6 socket address string is formatted as [`address`]:`port`
where `address` is shown as 16 hex values separated by `:` and `port`
is the port number in decimal format, for example "[%x:%x:...:%x]:%u".
2022-10-17 11:09:10 -07:00
Sarah 23c01d7eaf [docs] CLI commands ifconfig - linkmetrics (#8253) 2022-10-12 14:34:45 -07:00
Abtin Keshavarzian c4b6206f16 [srp-client] new feature to allow lease and key lease per service (#8211)
This commit add a new feature in `Srp::Client` to allow user to
specify the lease and/or key lease intervals explicitly per service.
The lease intervals in a service can be left unspecified(set to zero)
in which case the default lease intervals will be used.

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

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

This commit adds `test_srp_register_services_diff_lease` which covers
the behavior of the newly added mechanisms.
2022-10-06 18:31:25 -07:00
Abtin Keshavarzian d3e00fbd28 [dns] allow partial read of TXT data and add config for max size in CLI (#8232)
This commit updates `Dns::Client` so that when reading service info
`otDnsServiceInfo` if the received TXT data does not fit in the given
buffer, it is read partially. A new field `mTxtDataTruncated` is added
in `otDnsServiceInfo` to indicate that TXT data was not fully read.

This commit also updates `dns` related commands in CLI so to output
the partially read TXT data and add a new config specifying the max
TXT data size used by CLI.
2022-10-05 15:10:28 -07:00
Song GUO fc8949afb5 [nat64] fix typo: synthersize -> synthesize (#8213) 2022-09-29 10:51:06 -07:00
Abtin Keshavarzian 615e951ca9 [srp-server] add AutoEnableMode to give control to BR (#8129)
This commit adds new APIs and mechanisms to support `AutoEnableMode`
in SRP server. This mode allows us to delegate the control of SRP
server (when it is enabled or disabled) to the Border Routing
Manager.

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

This commit also adds CLI commands for the new APIs and adds a
test-case in `test_routing_manager` to test and validate the newly
added mechanism.
2022-09-20 22:04:58 -07:00
Sam Kumar 19f9ba20a3 [tcp] implement TCP Circular Send Buffer (#7867) 2022-09-19 10:30:48 -07:00
Song GUO 6973a1b067 [nat64] implement functions for NAT64 on the client side (#8126)
This commit adds the ability for accepting an IPv4 address for {ping,
tcp, udp} CLI commands.
2022-09-15 08:43:36 -07:00
Jiachen Dong a0c4ede86d [harness-simulation] add support for RF enclosure simulation (#8092)
This commit adds support for RF enclosure simulation. It can pass
Leader 9.2.9, Router 9.2.9 and Router 9.2.10 in Thread Test Harness
v56.0 now.
2022-09-14 14:31:06 -07:00
Song GUO b66d521d1d [nat64] implement CLI functions for NAT64 (#8058)
This commit introduces `nat64` command and 4 new subcommands
(`configuredcidr`, `configuredprefix`, `mappings`, `counters`)

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

This commit also introduces related API for the above commands, and
`otIp4AddressToString` & `otIp4CidrToString` for the CLI to format the
IPv4 address and CIDR.
2022-09-13 09:39:50 -07:00
Abtin Keshavarzian ccf8ea6923 [srp-client] update document about selected preferred server (#8125)
This commit updates `otSrpClientEnableAutoStartMode` documentation
to describe how the preferred server is determined from Network Data
entries (different Network Data entry categories, their order of
preference, and how to handle when there are multiple options within
the same category).
2022-09-06 15:27:22 -07:00
Song GUO bce7c1ae1f [nat64] change BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING (#8047)
We decided to rename BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING so
the flag won't be confusing since we have NAT64_TRANSLATOR which does
not depends on the border routing manager.
2022-08-30 21:05:28 -07:00
Sarah cd83fc1477 [docs] CLI Dataset (#7944) 2022-08-25 11:15:37 -07:00
Sarah 5516024905 [docs] CLI child commands (#8041) 2022-08-23 17:33:14 -07:00
Sam Kumar 0126c5f44b [tcp] modify cbuf to be able to use all bytes provided by the user (#7634) 2022-08-19 10:12:40 -07:00
Song GUO e84f05c641 [nat64] implement nat64 translator (ot::Nat64::Translator) (#7836)
This commit:

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

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

- exposes `otNat64Send(otInstance *aInstance, otMessage *aMessage)`
  and `void otNat64SetReceiveIp4Callback(otInstance *aInstance,
  otNat64ReceiveIp4Callback aCallback, void *aContext)`.
2022-08-18 22:28:26 -07:00
Abtin Keshavarzian f33a586530 [mle] new API to trigger search for better parent (#8018)
This commit adds `otThreadSearchForBetterParent()` to start the
process on a child to search for a better parent while staying
attached to its current parent. This commit also adds a related CLI
command `parent search`.
2022-08-12 16:05:53 -07:00
Yi 80565c58a9 [nat64] fetch NAT64 prefix from infrastructure interface and advertise it to netdata (#7619)
This commit fetches the NAT64 prefix on infrastructure interface and
advertise it to Network Data at medium preference.

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

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

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

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

The case that two or more BRs have same infrastructure NAT64 prefix is
not covered by this commit and will be followed up later.
2022-08-12 07:37:05 -07:00
Sarah c336a1899f [docs] CLI bbr (#7986) 2022-08-10 17:12:05 -07:00
Eduardo Montoya 4ce6a4708d [api] allow CSL receiver to gather parent CSL capabilities (#7991)
This commit extends the Thread API to allow a CSL Receiver application
to adjust its CSL parameters depending on the parent capabilities.

Specifically, it might decide to switch to polling operation instead
of CSL synchronization when the attached parent does not support CSL
Transmitter role (Thread Version 2) or it advertises poor CSL accuracy
or uncertainty.
2022-08-08 11:42:39 -07:00
Sarah 9a104a814c [docs] CLI channel (#7957) 2022-08-02 12:54:10 -07:00
Abtin Keshavarzian 5bc71b2a4f [message] allow msg pool using external heap (#7933)
This commit updates the code to allow the config combination of
`OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE` along using external heap
`OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`. This commit updates `Message`
`GetFreeBufferCount()` and `GetTotalBufferCount()` methods to return
special value `0xffff` under this config combo indicating the numbers
cannot be estimated.

This commit also updates `check-simulation-build-autotools` to add
such a build config so to be covered as part OT CI tests.
2022-07-22 15:43:48 -07:00
Abtin Keshavarzian 96819f934a [routing-manager] new API to get currently favored OMR prefix (#7913)
This commit updates `RoutingManager` to remember the currently favored
OMR prefix (which can be an OMR prefix discovered from Network Data
or device's local OMR prefix). It adds a new public API to retrieve
this prefix and adds a related CLI sub-command.
2022-07-21 21:32:52 -07:00
Sarah 78f8437c3b [docs] update CLI comments (#7902) 2022-07-16 18:41:13 -07:00
Song GUO 03c9b9389d [nat64] add functions for processing IPv4 packets (#7824)
With NAT64, we need to handle the IPv4 packets inside the border
router functions in OpenThread core.

This commit introduces a few new classes for NAT64:
- Add `Ip4::Cidr` (for specifying CIDR block of translated packets)
- Updated Ip4 address format -- use a union of (m8[4], m16[2], m32)
  instead of 4 bytes.
- Extend `Checksum` for supporting ICMP in Ip4 (and TCP4 / UDP4) and
  IPv4 header.
2022-07-15 10:54:20 -07:00
Abtin Keshavarzian 0ec9612379 [docs] add plat-infra-if and api-border-routing doxygen groups (#7898) 2022-07-13 19:59:47 -07:00
Abtin Keshavarzian 5876ff79ae [routing-manager] add public API to get discovered prefix table (#7877)
This commit adds new public OT APIs to iterate over the Border Router
discovered prefix table from received Router Advertisement messages.
It also adds new CLI command to output the prefix table. The new APIs
are primary intended for testing.
2022-07-11 11:58:27 -07:00
Abtin Keshavarzian 75ecf8d260 [api] add border_routing.h header for otBorderRouting APIs (#7877)
This commit adds `<openthread/border_routing.h`> header and moves
all the `otBorderRouting` APIs (which are related to Border Routing
Manager) into this header. It also adds a note that these APIs are
available when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled.
It also adds `border_routing_api.cpp` source file for the API
implementation.
2022-07-11 11:58:27 -07:00
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
Sarah 4747a9c776 [docs] add Doxygen support for CLI comments (#7749) 2022-06-28 16:44:39 -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 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
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
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
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
Ł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