Commit Graph

164 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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 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