Commit Graph

138 Commits

Author SHA1 Message Date
Jonathan Hui ecd4c92465 [dua] completely remove DUA features and configurations (#13191)
This commit removes the OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE feature
and all associated code, tests, CLI commands, and harness references.

Changes:
- Removed OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE definition and all
  assert/preprocessor checks.
- Completely deleted dua_manager.cpp and dua_manager.hpp.
- Removed DUA registration notifying and request URI paths.
- Cleaned up all references to Domain Unicast Address (DUA) across
  child management, notifier, time ticker, and MLE.
- Removed DUA commands and logic from the CLI and Python cert tests
  (including packet verifier).
- Verified that the entire codebase compiles clean and all tests
  successfully pass using the Nexus test suite.
2026-06-03 12:29:18 -07:00
Jonathan Hui 136bdb6e2a [dua] remove OPENTHREAD_CONFIG_DUA_ENABLE build feature (#13165)
This commit completely removes the local Domain Unicast Address (DUA)
registration feature flag (OPENTHREAD_CONFIG_DUA_ENABLE) and all of
its associated implementation, public APIs, CLI commands, Spinel
property handlers, and certification tests.

Thread 1.2 FTD Border Router/Router DUA proxying features for MTD
children (OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) are preserved and
updated to only compile/instantiate components when proxy DUA
features are active.

Detailed Changes:
- Remove default definition of OPENTHREAD_CONFIG_DUA_ENABLE from
  misc.h.
- Remove OT_DUA and openthread_config_dua_enable from CMake/GN
  configs.
- Remove otThreadSetFixedDuaInterfaceIdentifier and
  otThreadGetFixedDuaInterfaceIdentifier from
  include/openthread/thread.h
  and implementation src/core/api/thread_api.cpp.
- Remove CLI DUA interpreter from src/cli/cli.cpp.
- Remove SPINEL_CAP_DUA capability and SPINEL_PROP_THREAD_DUA_ID
  Spinel property handlers and dispatchers from NCP.
- Strip local DUA management features (conflict checking, SLAAC DUA
  interface identifiers, and dad info settings) from DuaManager, MLE,
  Address Resolver, and settings.
- Clean up Notifier, TimeTicker, and TMF dispatcher guards.
- Clean up -DOT_DUA=ON compilation flags across build/test scripts.
- Delete obsolete DUA certification tests:
  - v1_2_test_domain_unicast_address
  - v1_2_test_domain_unicast_address_registration
  - v1_2_test_dua_handle_address_error
2026-06-01 15:16:19 -07:00
Jonathan Hui 4c9791cb9b [ci] clone ot-br-posix submodules recursively in CI/CD (#13130)
When cloning the ot-br-posix repository to run the Docker-in-Docker
integration tests, the clone was shallow and did not recursively
check out nested submodules (such as cJSON and cpp-httplib). This led
to build failures inside the Docker build container since libcjson
is not pre-installed on the base build image.

This commit resolves the issue by:
1. Appending the `--recurse-submodules` flag to the git-tool clone
   calls in `otbr-posix-dind.yml` and `script/test`.
2. Updating `script/git-tool`'s destination directory parsing to
   robustly handle multi-line output from recursive submodule
   checkouts. The new pattern extracts the path exclusively from
   the first line using `sed` to prevent SIGPIPE or parsing errors.
2026-05-21 15:34:05 -07:00
Abtin Keshavarzian 968ae74341 [tests] add timeout to cert suite execution (#12379)
Currently, the `run_cert()` function in `run_cert_suite.py` invokes
test scripts using `subprocess.check_call()` without a timeout. This
can cause the test suite to hang indefinitely if a test script fails
to terminate.

This commit updates `run_cert_suite.py` to support a configurable
`--timeout` argument. It passes this timeout to `check_call()` and
handles `subprocess.TimeoutExpired` to log failure and print output
upon timeout.

Additionally, this commit updates `script/test` to pass the
`TEST_TIMEOUT` environment variable to the test runner and updates
GitHub workflow configurations to define specific timeout values for
various test jobs.
2026-02-09 11:38:18 -08:00
Yakun Xu a3b8361a19 [simulation] set virtual UART at runtime (#12199)
This commit changes the virtual UART to be configured at runtime, which
eliminates a build variants, which causes code coverage process problem.
2025-12-09 08:48:37 -08:00
Li Cao d7fe525415 [github-actions] disable Discovery Proxy in the otbr Backbone CI (#12195)
This commit disables Discovery Proxy in otbr Backbone CI.

Because in this item, `BORDER_ROUTING` is explicitly disabled and it
is required by OT discovery proxy.

This commit removes `"-DOTBR_DNS_UPSTREAM_QUERY=ON"` in build script
because this option will automatically handled in the cmake options
file and it also depends on BORDER_ROUTING. Force it to be ON will
cause a conflict when BORDER_ROUTING is OFF.
2025-12-04 08:24:35 -08:00
Zhanglong Xia 4cb0de4233 [p2p] add initial peer-to-peer support (#11494)
This commit implements a minimum P2P which only supports
sending/receiving wake-up frames and establishing P2P links between
rx-on-when-idle devices.
2025-09-02 10:12:13 -07:00
Jason Zhang 5e04b4e261 [cmake] fix SRP server fast start mode option typo (#11798)
fix misspelled `OT_SRP_SERVER_FAST_START_MODE` build option
2025-08-08 10:36:55 -07:00
Li Cao 34bb0e4ab1 [test] remove the node type rcp-ncp (#11752)
The type `rcp-ncp` was meant to run nodes of NCP on posix. But we
don't have NCP on posix anymore. So this can be removed.
2025-07-28 11:20:43 -07:00
Yakun Xu 1662ca8001 [simulation] add reliable virtual time transport (#11029)
This commit adds a reliable transport based on SEQPACKET unix socket to
simulation platform and use this for tests on simulation platform.
2025-06-04 23:32:25 -07:00
Jonathan Hui 37b417a3ee [test] update OTBR Dockerfile path (#11390) 2025-04-02 10:14:33 -07:00
Abtin Keshavarzian babbccd4c6 [srp-server] introduce "fast start mode" feature (#11305)
This commit adds "Fast Start Mode" feature for SRP server. This
feature is designed for scenarios where a device, often a mobile
device, needs to act as a provisional SRP server (e.g., functioning
as a temporary Border Router). The SRP server function is enabled
only if no other Border Routers are already providing the SRP
service within the Thread network. A common use case is a mobile
device joining a Thread network where it may be the first, or only,
BR. Importantly, Fast Start Mode allows the device to quickly start
its SRP server functionality upon joining the network, allowing other
Thread devices to quickly connect and register their services without
the typical delays associated with standard Border Router
initialization and SRP server startup (using NetData Publisher).
2025-02-28 13:49:30 -08:00
Jonathan Hui ff19e03afa [scripts] SC2317: command appears to be unreachable (#10821) 2024-10-11 20:45:56 -07:00
Song GUO 7cd179e23a [routing-manager] stop PD if there is another prefix with higher preference in netdata (#10289)
This commit adds a new IDLE state to PdPrefixManager.

PdPrefixManager enters idle state when PD is enabled and there is
already a BR requesting PD prefix. When there are multiple BRs
publishing PD prefix at the same time, the one with lexcial smaller
prefix wins.
2024-09-29 23:27:30 -07:00
Damian Królik bc50521cfa [mac] multipurpose wake-up frame support (#10728)
1. Add OT_WAKEUP_COORDINATOR and OT_WAKEUP_END_DEVICE build
   options.
2. Add support for parsing and constructing 802.15.4
   Multipurpose frames.
3. Add support for parsing and constructing wake-up
   frames.
2024-09-23 09:02:15 -07:00
Jonathan Hui 2f51cababf [github-actions] migrate version 1.3 checks to 1.4 (#10694) 2024-09-11 07:25:32 -07:00
Li Cao c36c0ed760 [ncp] add NCP based implementation (empty) of platform InfraIf APIs (#10638)
This implementation will be used on all platforms for NCP nodes
(simulation, any vendor platforms). However the simulation platform
already has a different implementation. To avoid conflicts, the commit
adds a control flag in simulation config so that we can choose whether
to enable the simulation implementation.
2024-09-04 07:48:59 -07:00
Mason Tran 502797c0b3 [spinel] add support for logging crash dumps (#10061)
This commit adds a new feature that allows platforms to log crash logs.

### Additions
- `void otPlatLogCrashDump(void)` - API that logs a crash dump using
  OpenThread Logging APIs
- `SPINEL_PROP_RCP_LOG_CRASH_DUMP` - spinel prop that calls
  `otPlatLogCrashDump()` when `Set`
- `SPINEL_CAP_RCP_LOG_CRASH_DUMP` - spinel capability denoting that a
  RCP supports logging crash dumps

### Usage
- For `ot-cli-ftd|mtd`, `otPlatLogCrashDump()` is called at the end of
  app initialization, before the main loop. See [main.c]
- For Host/RCP setups, during initialization, the Host gets the RCP
  capabilities. If the RCP has the `SPINEL_CAP_RCP_LOG_CRASH_DUMP`
  capability, the Host will `Set` the `SPINEL_PROP_RCP_LOG_CRASH_DUMP`
  property, triggering the RCP to call `otPlatLogCrashDump()`.
  - If RCP Recovery is enabled, the this will also happen once the RCP
    has been restored
2024-04-29 09:09:54 -07:00
Mason Tran 0b0db37a13 [api] add API to reset to bootloader mode (#9523) 2023-10-27 15:54:15 -07:00
whd 17286dbd24 [script] exclude ot_testing and __pycache__ when building the OTBR docker (#9457)
This commit excludes `ot_testing` and `__pycache__` directories when
copying the files before building the docker.

Such files are usually generated by root user and will cause errors
when copying them as a non-root user.
2023-09-27 10:41:07 -07:00
whd a383e366ba [firewall] implement packet filtering in OT core (#9402)
This commit implements the packet logic in OT core. It aims to have
the same effect as what's already achieved by our iptables-based
firewall. Instead of leveraging iptables, this commit filters the
border routing packets in user space by checking the
source/destination addresses of a packet.

This commit also adds a job to do BR regression test when this feature
is enabled and iptables-based firewall is disabled.
2023-09-15 11:52:26 -07:00
Li Cao 8c2abba2f8 [link-metrics] implement link metrics manager (#9375)
This commit implements a new module LinkMetricsManager, which utilizes
the Link Metrics feature to get the Link Metrics data from neighboring
devices.

The commit also adds a few tests to the module:
- Unit Test: tests/unit/test_link_metrics_manager.cpp, will be run in
  `unit-tests` in `unit.yml`.
- Expect Test: tests/scripts/expect/v1_2-linkmetricsmgr.exp, will be
  run in `expects` in `simulation-1.2.yml`.
- Simulation Test:
  tests/scripts/thread-cert/v1_2_LowPower_test_link_metrics_manager.py,
  will be run in `packet-verification-low-power` in
  `simulation-1.2.yml`.
2023-09-02 08:14:24 -07:00
Abtin Keshavarzian d5a09415be [script] update the check-size report (#9368)
This commit updates the `check-size` script and how the OpenThread
size report is generated and reported.

The size report now includes four device types:
- FTD (not acting as a BR)
- MTD (including SED)
- Border Router (BR)
- RCP

Each type uses its own example config header file (e.g., BR uses
`examples/config/ot-core-config-check-size-br.h`). These header files
specify all the OT configs and enable/disable the set of features
that make sense for the given type.

This replaces the previous model where the same set of configs were
used for all types. This change allows us to track the code size of a
typical BR build, as well as the code size of other device types.

In order to build and generate a size report for the BR configuration
example with BR-specific features enabled (such as Border Routing
Manager or NAT64), we need an implementation of the related platform
APIs that are used by these features (e.g. `otPlatInfraIf` APIs).
This commit adds mock empty implementations of these APIs, which are
only included in the size-report builds.
2023-08-25 11:29:39 -07:00
Li Cao 4b0b93ad00 [radio] add radio statistics of tx/rx/sleep cycle (#9071)
This commit implements time counting in radio to collect the time when
radio is in sleep/tx/rx time. 2 new APIs are added to get and reset
the statistics. This feature is only available on FTD and MTD. This PR
also adds cli commands to call the APIs on example cli firmware.  This
feature is by default disabled in OT core config. It's enabled on
simulation platform by default now.

Regarding implementation, this feature is totally implemented by
software.  It uses a simplified model to calculate the time. It may
not be very accurate, but it should be enough to give us an overview
of the time.
2023-06-14 13:30:02 -07:00
Yakun Xu 30b79ccee8 [test] migrate tests to cmake (#8929)
This commit migrate tests not targeting autotool to cmake.

* removed openthread-test-driver
* removed functional tests from autotool based check
* corrected file permission of python scripts
* added --run-directory to specify directory to collect logs and captures
* get test-ot-test-srp-server pass on POSIX platform
2023-05-04 09:59:24 -07:00
Yakun Xu 720965ae1b [test] disable INTER_OP_BBR by default (#8952)
This commit disables `INTER_OP_BBR` by default to avoid unnecessary
build in most times.
2023-04-13 22:58:07 -07:00
Song GUO fa6824c9cb [test] add tests for DNS forwarding (#8847)
This commit adds a new file
`tests/scripts/thread-cert/border_router/nat64/test_upstream_dns.py`
to test scripts for testing the DNS forwarding functions.

The test adds a record `test.domain` to the bind9 interface since when
adding to DNSSD tests, the OpenThread's DNSSD server will be conflict
with the Docker's DNS forwarding functions.
2023-03-30 15:06:55 -07:00
whd 8c2187ee72 [docker] avoid unnecessary copying when building an image for testing (#8780)
This commit lets `do_build_otbr_docker()` skip unnecessary files when
copying the source code for building a docker image. It can save time
and disk space for the user.
2023-02-21 09:28:50 -08:00
Jonathan Hui 48c0582e4e [shellcheck] fix SC2155 warning (#8490)
Declare and assign separately to avoid masking return values.
2022-12-07 16:23:20 -08:00
Song GUO 06a6de24fa [nat64] add functional tests (#8161)
The test includes:
- Counters (protocol & error (4to6 no mapping, other errors are not
  expected))
- ICMP ping Connectivity
- UDP connectivity
2022-09-29 10:54:49 -07:00
Song GUO 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
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
Yi bec3a5edb0 [nat64] fix build options for NAT64 tests (#7929)
This commit fixes the build options for NAT64 tests. A new option was
added in ot-br-posix recently.
2022-07-21 07:22:27 -07:00
Yi 095f530bd7 [nat64] run nat64 ci tests as an independent job (#7885)
This commit changes the NAT64 CI tests to be ran as an independent
job. A new /nat64 folder is added and it would make it easier to
configure new NAT64 tests in the future.
2022-07-18 14:15:00 -07:00
Jonathan Hui 0c48ade2ff [tests] change 1.2 builds to 1.3 (#7756) 2022-06-08 11:44:23 -07: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
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 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
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 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
Jonathan Hui ea2783f5cb Revert "[border-router] firewall: ingress filtering (#7043)" (#7096)
This reverts commit c88a37b658.
2021-10-20 23:14:39 -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
kangping 31320993fb [docs] add document for running BR tests locally (#7044) 2021-10-01 08:13:31 -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 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
Simon Lin 7ba6111516 [thread-cert] output more logs in OTBR tests (#7003) 2021-09-13 08:49:02 -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 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
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
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