Commit Graph

171 Commits

Author SHA1 Message Date
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
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 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
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
Jonathan Hui aaabf25ff2 [network-key] change name from master to network (#6721) 2021-06-16 23:07:23 -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
Simon Lin e0a1987336 [ip6] set Mesh Local IID for Reference Devices (#6599) 2021-05-11 21:38:14 -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 5b425a1b58 [tests] fix dig output TXT parsing (#6577) 2021-05-07 12:37:56 -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
whd c8902e9419 [scripts] MATN-TC-05: Re-registration to same Multicast Group (#6444) 2021-04-22 22:17:03 -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
whd 7a2465f751 [cli] support -I {src-addr} for ping command (#6470) 2021-04-22 12:43:26 -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
kangping 423575fceb [meshcop] support Thread 1.2 Security Policy flags (#6320) 2021-04-14 08:16:08 -07:00
whd 3e833c120f [scripts] MATN-TC-02: Multicast listener registration and first use (#6409) 2021-04-13 21:14:44 -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 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
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
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
whd bbbeee17fb [ping-sender] show ping reply statistics (#6341) 2021-03-30 09:54:14 -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 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
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
Jonathan Hui 1e6e9ec8c2 [tests] add test for dataset updater (#6227) 2021-03-08 08:48:04 -08:00
Simon Lin a46b565cbf [tests] add test to verify DHCP6 client works after reset (#6204) 2021-03-03 11:21:44 -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 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 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
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
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
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
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
Simon Lin ad5dd8ecd8 [thread-cert] fix python syntax warning (#6150) 2021-02-08 11:38:38 -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
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
kangping 7cd85bfe5d [tests] add CI tests for SRP server & client (#6074) 2021-01-22 13:19:21 -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
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
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
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
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
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
Jing Ma 0e105524cb [thread-cert] add case 5.8.4 SecurityPolicyTLV using pktverify (#5967) 2020-12-18 08:05:08 -08:00
Jing Ma 69e97581e7 [thread-cert] add case 8.1.6 using pktverify (#5898) 2020-12-14 23:24:43 -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 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