Commit Graph

629 Commits

Author SHA1 Message Date
Song GUO 4c70cbb162 [nat64] NAT64 translator should be active only when local prefix is published (#8558)
If an infrastructure-provided NAT64 prefix is present, we should
bypass the NAT64 translator to let the border router forward the
packet to the infra NAT64 service.
2022-12-21 17:52:00 -08:00
Abtin Keshavarzian 58c9ca84ff [pretty] combine strings in node.py (#8550) 2022-12-19 14:37:30 -08:00
Song GUO 2db38b0335 [test] ensure NAT64 is enabled when running NAT64 tests (#8520)
We cannot ensure NAT64 is enabled when running tests, and calling an
extra nat64_set_enabled has no side-effects.
2022-12-13 12:50:07 -08:00
whd c5ee313500 [tests] verify the RA/RS fields in border routing counters (#8494) 2022-12-12 16:18:13 -08:00
whd c9f3d08843 [tests] verify that SRP services are removed when their host expires (#8493)
This commit adds a step in `test_srp_lease.py` to verify that SRP
services are removed when their host expires.
2022-12-08 17:28:39 -08:00
Yi 2167fda5a8 [nat64] delete nat64_set_enabled() when starting BR in tests (#8476)
NAT64 is enabled by default.
2022-12-05 11:53:21 -08:00
Song GUO b468a25a61 [nat64] use dbus API for NAT64 tests (#8392) 2022-11-22 21:39:11 -08:00
whd caec27dcf1 [tests] add tests for Border Routing Counters (#8341)
This commit adds tests for verifying the functionality of the D-BUS
API `GetBorderRoutingCounters`.
2022-11-12 04:42:58 +01:00
Abtin Keshavarzian d4d872c05c [test] increase wait time after ether re-enable (#8322)
This commit increases the wait time in `test_single_border_router`
after re-enabling `ether` link. It also changes the order of pings
in the test (first ping from host to Thread router and the opposite
direction).
2022-10-27 02:07:30 -07:00
Song GUO aae250af89 [nat64] add runtime switch for NAT64 prefix publisher and translator (#8194) 2022-10-18 14:42:25 -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 ba3d188db7 [srp-client] update "single service mode" to handle many removes (#8207)
This commit fixes the "single service mode" behavior to handle
if there are many simultaneous service removes. It also updates the
test to cover this situation.
2022-09-29 15:37:26 -07: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
Abtin Keshavarzian 6dca78e757 [link-metrics] add blocking CLI query command and enhance tests (#8108)
This commit updates CLI `linkmetrics query` command to allow it
to be used in blocking mode (wait for response to query). This
is then used in different tests to validate the `LinkMetrics`
module behavior. In particular, `v1_2_test_single_probe` and
`v1_2_LowPower_7_2_01_ForwardTrackingSeries` are updated to
validate that the received query report message is correctly
parsed.
2022-09-01 10:49:02 -07:00
Simon Lin 30d65bca48 [thread-cert] import Crypto on demand (#8109)
This commit imports `Crypto` module only when it's used.

This helps thread-cert tests that do not use message factory to run
without having to install `Crypto` module.
2022-08-31 19:48:24 -07:00
whd 8942e7f895 [multicast-routing] block egress multicast packets from LLA (#8059)
According to the Spec, egress packets from LLA should not be
forwarded. Linux kernel doesn't automatically block such forwarding
so that we need to check this before adding the MFC entry.
2022-08-22 16:34:52 -07:00
Yi e50be395e4 [nat64] extend wait time between test cases and verify netdata stabilized (#8057)
This commit extend the wait time after disabling border routing and a
new case is added to verify that the netdata is stable again.
2022-08-22 16:14:07 -07:00
whd 20aee3fa70 [multicast-routing] don't add MFC entries using mesh local as the source address (#8025)
According to Thread Spec, PBBR should not forward a multicast packet
from Thread interface to Backbone interface when the source address is
Mesh-Local.
2022-08-17 22:59:50 -07:00
Simon Lin f790edd5e2 [github-actions] upgrade pyshark to 0.4.6 (#8030) 2022-08-16 16:23:43 -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
whd df2c11a6cb [tests] add test for Advertising Proxy to publish zero or multiple host addrs (#8003) 2022-08-10 21:24:44 -07:00
Abtin Keshavarzian 82ce9dd4c4 [csl] update CSL Channel TLV process to allow for unspecified case (#8005)
This commit updates how unspecified CSL channel is conveyed in MLE
messages. Special value of zero in CSL Channel TLV is used to
indicate that the CSL channel is unspecified. The exclusion of the
TLV keeps the CSL channel as before (no change to the previously
set CSL channel).
2022-08-10 15:00:48 -07:00
Simon Lin 2615d10db8 [border-agent] refine meshcop service state bitmap checks (#7950) 2022-08-04 21:18:19 -07:00
Abtin Keshavarzian b6ac79f61a [test] fix test_mle_msg_key_seq_jump (#7952)
This commit updates `test_mle_msg_key_seq_jump` to increase the wait
time after key index change for MLE advertisement transmissions. The
MLE advertisement uses trickle timer with max interval of 32 seconds.
Based on this the max interval between two consecutive advertisement
transmissions can be 1.5 times the trickle timer max interval or 48
seconds. The test uses 52 sec as wait time which includes a 4 sec
additional guard time to account for any action and/or message
exchanges after rx of an advertisement. This change should help
address the occasional failures of this test.
2022-07-27 18:58:47 -07:00
Eduardo Montoya 424005f695 [csl] test resync after parent is down for a long period (#7915)
Add test steps to verify that a CSL Receiver is able to re-establish
CSL synchronization after its peer has been absent for a long period.
2022-07-20 15:11:34 -07:00
Simon Lin e538aad095 [thci] find border agents with non link-local addresses (#7853)
Thread BR may advertise IPv6 GUA rather than LLA. For example, Avahi
stops publishing LLA when any GUA is found on the network interface.

This commit enhances mdns_query to find border agents with
non-link-local addresses.
2022-07-19 09:12:17 -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
Abtin Keshavarzian 5d09e9ca4f [mle] update number parent requests in an attach cycle (#7538)
This commit updates the MLE attach process so that in the first attach
cycle device tries a total of six MLE Parent Requests, the first two
to routers only followed by four to routers and REEDs. For example,
the six Parent Request message will be used before device can decide
to act the leader. An MTD in the next attach attempt (if cannot find a
parent in first attempt cycle), will go to the model of two Parent
Requests (first to routers, then to routers/REEDs).

This change impacts the time it takes for a device to start as leader
(due to increased number of Parent Request and wait time). This commit
updates different test scripts to address the change in the wait
time. It adds a new `config.LEADER_STARTUP_DELAY` constants which is
used for wait time for leader to start.
2022-07-07 16:50:21 -07:00
Eduardo Montoya b058ea4e17 [dua] allow MTD to handle ADDR_ERR.ntf messages (#7844)
An MTD interface should be able to handle Address Error Notifications
as per Thread Specification section 5.6.4.
2022-06-29 11:11:46 -07:00
Abtin Keshavarzian 733750b3de [mle] handle rx key seq update based on MLE message class (#7672)
This commit implements new mechanism in `Mle` related to key sequence
update when an MLE message is received with a larger key sequence
compared to the one being used by `KeyManager`. The MLE messages are
categorized into classes of Authoritative, or Peer depending on the
MLE command type and included TLVs. The class determines different
actions: Authoritative indicates sender is confident that its key seq
is in sync, so receiver will adopt the larger key seq. Peer class is
used when both sender and receiver think they are in sync. In this
case, if the MLE message is from a known neighbor, receiver will
adopt the larger key seq if the difference is one, otherwise it will
try to re-establish link with the neighbor using Authoritative
message exchanges (e.g. sending Link Request or Child Update
Request).
2022-06-24 12:21:04 -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
Abtin Keshavarzian 64e837861f [netdata] add feature for BR to request router role upgrade (#7597)
This commit adds a new mechanism to allow border routers to request
router role upgrade.

A border router which provides IP connectivity (either adding an
external route prefix or an on-mesh prefix with default route flag)
and is acting as a REED is eligible to request a router role upgrade
by sending an "Address Solicit" request to leader with status reason
`BorderRouterRequest`. This reason is used when the number of active
routers in the Thread mesh is above the threshold, and only if the
number of existing eligible BRs (determined from the network data)
that are acting as router is less than two. This mechanism  allows up
to two eligible border routers to request router role upgrade when
the number of routers is already above the threshold.

This commit also adds a new test-case `test_br_upgrade_router_role`
which validates the behavior of the new mechanism.
2022-06-22 11:45:30 -07:00
Simon Lin c055c10a9a [routing-manager] self-generated OMR prefix to use P_preference=Low (#7802) 2022-06-16 19:42:10 -07:00
Simon Lin edbb07d95f [tests] verify a Router can establish links quickly via multicast Link Request (#7807)
This commit adds a test to make sure delay sending multicast Link
Request (#7745) works as intended.
2022-06-13 09:54:57 -07:00
Jonathan Hui b2132a9031 [tests] add 1.3.0 as valid version in test_publish_meshcop_service.py (#7801) 2022-06-08 15:22:36 -07:00
Jonathan Hui 0c48ade2ff [tests] change 1.2 builds to 1.3 (#7756) 2022-06-08 11:44:23 -07:00
Abtin Keshavarzian 9e887eb77a [srp-client] message MTU check and single service mode (#7776)
This commit adds a new mechanism in `Srp::Client`: When preparing an
update message, client will check whether the prepared message fits
in an IPv6 MTU (1280 bytes). If it does not, the SRP client would
temporarily enable "single service mode" which ensures only a single
service (along with its sub-types) to be appended in the SRP update
message. After the message is sent SRP client would switch back to
normal behavior and disables the single service mode.

This change addresses situation where user may register many services
(with multiple sub-types and long TXT data) which then may not fit
in a single UDP message payload.

This commit also adds `test_srp_many_services_mtu_check` test which
verifies the newly added behavior.
2022-06-07 11:13:20 -07:00
Jonathan Hui 171fbd82cf [tests] relax MLE Adv delay check in Cert_5_3_06_RouterIdMask (#7788)
Time delay between MLE Advertisements after reset can be up to 3.5
seconds. For example:

- 0.0s: Reset Interval, reset interval to 1 seconds, random interval
        at 0.5 second
- 0.5s: Transmit MLE Advertisement
- 1.0s: Set interval to 2 seconds, random interval at 2 seconds
- 3.0s: Receive MLE Advertisement, reset interval to 1 second, random
        interval at 1.0 second
- 4.0s: Transmit MLE Advertisement
2022-06-06 10:52:15 -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
Jonathan Hui 33cc75ed3b [srp-server] implement TTL processing (#7738) 2022-05-31 22:01:27 -07:00
Jonathan Hui 81a948b4d8 [mle] evaluate neighbor links before upgrade to router (#7765)
OpenThread only etablishes links when the link margin is above a
certain threshold, to help ensure that links in the routing topology
are stable. However, if a device has no existing links to neighboring
routers above threshold, then upgrading to a router is useless and
disruptive.

This commit adds a check to ensure there is at least one neighbor
above the link margin threshold before upgrading to a router.
2022-05-27 13:15:58 -07:00
Jonathan Hui 1b4a866fea [tests] disable some checks in Cert_9_2_09 (#7771)
Disable steps 32, 33, and 34 until a solution is found. Depending on
timing, there may be one MLE Data Request/Response exchange for both
Active and Pending Operational Datasets or individual MLE Data
Request/Response exchange for each Active and Pending Operational
Dataset separately.
2022-05-27 10:46:35 -07:00
Jonathan Hui f75d03f6cb [mle] delay sending multicast Link Request (#7745)
A device sends a multicast Link Request message after becoming a
router to quickly and efficiently establish links with neighboring
routers. However, sending a Link Request too quickly can fail in cases
where the neighboring router(s) have not yet received the updated
Router ID set from the Leader.

This commit delays sending the Link Request to allow time for
neighboring routers to receive the updated Router ID from the Leader.
2022-05-26 09:16:49 -07:00
Simon Lin d266f90fbf [tests] mcast6.py to receive UDP messages without JOIN_GROUP (#7757)
`mcast6.py` is used by GitHub Actions CI to send or receive UDP
messages in multicast groups.

This commit adds a `-u` argument to allow `mcast6.py` to receive UDP
messages without joining a multicast group.
2022-05-26 08:57:42 -07:00
Jonathan Hui 56db0d3eff [routing-manager] remove vicarious router discovery feature (#7727)
The vicarious router discovery feature depends on the ability to
receive Router Advertisement messages sent in response to Router
Solicitation messages from other hosts. However, this does not work
since Router Advertisement messages are often sent unicast in
response.
2022-05-23 13:26:04 -07:00
Simon Lin 65c6f39300 [routing-manager] handle deprecated OMR prefix (#7703)
This commit enhances routing-manager to avoid using deprecated
(i.e. P_preferred=false) OMR prefixes as the winning OMR prefix, but
still sends RA RIO for the deprecating OMR prefixes.
2022-05-23 11:07:40 -07:00
Jonathan Hui fcbc4bef9b [srp-client] add API to specify TTL (#7735) 2022-05-20 15:34:50 -07:00
Jonathan Hui 5fbf1bec88 [tests] use common definition for border router startup delay (#7721) 2022-05-20 08:53:34 -07:00
Jonathan Hui 5107ee6238 [thread-cert] update Cert_5_5_05_SplitMergeREED to expect 16 routers (#7719)
Cert_5_5_05_SplitMergeREED.py was intermittently failing to find an
MLE Advertisement that had a Route TLV with 15 entries. However, the
test topology has 16 routers in steady state. Update packet filter to
look for 16 routers.
2022-05-19 09:15:54 -07:00