Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
Merge "Clean up BpfCoordinatorTest" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-11-22 03:35:42 +00:00
be2750fc3f
Merge "SyncSM09: Add Callback to UpstreamNetworkMonitor" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-11-21 17:29:10 +00:00
309365558c
SyncSM09: Add Callback to UpstreamNetworkMonitor
Instead of passing state machine to UpstreamNetworkMonitor, wrapped it
by an interface would have two benefits:
1. Easier for testing.
2. Isolate state machine operation in callback.

Test: atest TetheringTests
Change-Id: I2a97fd5cbc8c49df8c3c98428c6570916ab31ea5

Mark   commited 2023-11-21 05:53:29 +00:00
4465e4e2bd
Clean up BpfCoordinatorTest
1. assertEquals syntax is (expected, actual) and not the other way
   around
2. use assertArrayEquals to compare arrays

Test: atest TetheringTests
Bug: 312072637
Change-Id: I5eb0c270323253f648d3a8fd488506b9ad1ca6a1

KH Shi   commited 2023-11-20 13:39:12 +00:00
035bed35bb
Fix endian error when pass upstream prefixes to bpf
TetherUpstream6Key#src64 should be stored in network order. Use
a big-endian ByteBuffer to retrieve a value stored in network order
is actually converts it into native order, which is little-endian in
Android.

In this CL, we changed it to use byte[] instead of long to store the
top 64-bits of the source prefix.

Test: atest TetheringTests
      manual test with IPv6-only tethering upstream, check BPF stats.
Bug: 312072637
Change-Id: I79f9282d5eda28328aa6a764ea92b086d6285133

KH Shi   commited 2023-11-20 08:10:53 +00:00
84e3fb3afd
Merge "Remove unnecessary dropShellPermissionIdentity" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-11-08 02:18:53 +00:00
24eab1c274
Merge "[Refactor] move BPF tests to BpfCoordinatorTest" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-11-08 01:30:12 +00:00
f9e70f9bf3
Remove unnecessary dropShellPermissionIdentity
The test doesn't explicitly call adoptShellPermissionIdentity anymore. Instead it use runAsShell everywhere. Remove the dead code.

Bug: 254183718
Change-Id: Ia949e0e315a3b3ae915752e95ef9fe896fdc0f5b
Test: TH

Mark Chien   commited 2023-11-07 08:25:53 +00:00
f05b4475cd
[Refactor] move BPF tests to BpfCoordinatorTest
Preparing for refactor of IpServer and BpfCoordinator. All BPF related
code are planned to migrate from IpServer to BpfCoordinator. This CL
moves BPF related tests from IpServerTest to BpfCoordinatorTest first.

Test: atest TetheringTests
Bug: 294025403
Change-Id: I000f27c463368202dbbe2ace188c8c5146669096

KH Shi   commited 2023-11-07 04:32:57 +00:00
cbee43da40
Merge "Extend tethering enable/disable timeout to 30 seconds" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-11-07 03:52:26 +00:00
9f76411b63
Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: I2fa6250875d517c3452c85a3678d3feb0c0354d8

Chalard Jean   commited 2023-11-02 23:25:32 +09:00
820ce9df2d
Merge "SyncSM8.2: make IpServer support syncSM" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-10-30 07:51:54 +00:00
0b8bdb1074
Merge "SyncSM8.1 always call transitionTo under processMessage" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-10-30 07:51:06 +00:00
bdf6178a1a
Merge "Revert "Add forwarding methods to RoutingCoordinator"" into main
Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2023-10-28 06:34:26 +00:00
e26f93318c
Revert "Add forwarding methods to RoutingCoordinator"
This reverts commit 55ccfe19e2.

Reason for revert: this must be introducing some sort of race
it appears to cause
  atest EthernetTetheringTest 'NetdBinderTest#TetherForwardAddRemove'
to no longer reliably pass.

Change-Id: I5281ab3f42c5ce268d97a12db24a6768db3f4354

Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2023-10-28 02:10:52 +00:00
543d0d32e4
Merge changes Ibe22b300,I0b0f0bf1 into main
* changes:
  SyncSM08: handle IpServer requestEnableTethering callback in mainSM
  SyncSM07.1: Add a test that shows tethering restarts when disabling

Mark Chien   authored and   Gerrit Code Review   commited 2023-10-27 08:50:04 +00:00
2c7e2b8448
Merge "Pass upstream prefixes to bpf tethering offload" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-10-27 07:23:52 +00:00
f92d211c71
Merge "Add forwarding methods to RoutingCoordinator" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-27 05:12:07 +00:00
23376e6fe7
Pass upstream prefixes to bpf tethering offload
BPF needs upstream prefixes information to filter spoofing IPv6 source
addresses carried in downstream traffic.

We retrieve prefixes from upstream interface's LinkProperties and pass
it to the BpfCoordinator. Forwarding rules will also be updated when
upstream interface's IPv6 link addresses change.

Test: atest TetheringTests
Bug: 261923493
Change-Id: If8cfc3b191e520ca838654d1b5211ab9e9ec021d

KH Shi   commited 2023-10-26 13:13:38 +00:00
3f738fcd3d
Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: Ic3b36ddc236e8615e7d931b6e526556bbd2dac17

Chalard Jean   commited 2023-10-26 20:18:48 +09:00
55ccfe19e2
SyncSM8.2: make IpServer support syncSM
After this change, IpServer could switch to use syncSM.

Test: atest TetheringTests
Change-Id: I2d7fa47cd020f3e76e7a8beaefb98852e93545f8

Mark   commited 2023-10-26 09:34:23 +00:00
be99f86ad9
SyncSM8.1 always call transitionTo under processMessage
As state transitions always occur after a message has been processed,
calling transitionTo only under processMessage makes the flow easier
to understand and less error-prone.

The risk of this change is very minimal since it is only about
handling the error, but tethering will stop regardless.

Test: atest TetheringTests

Change-Id: I56c6cf6cc989464ee84a8333ac131afc808a3d95

Mark   commited 2023-10-26 09:31:18 +00:00
50eef8316c
SyncSM08: handle IpServer requestEnableTethering callback in mainSM
This can make it easier to adopt SM shim replacement in follow up change,
as both SyncSM and AsyncSM will process the same message without any
difference.

This change also fix a problem that bring up downstream before it's
IpServer completely disabled.

Previous:
CMD_NOTIFY_PREFIX_CONFLICT -> requestEnableTethering(false) ->
requestEnableTethering(true) -> IpServer stopped ->
reportTetherStateChanged(downstream inactive) -> IpServer started
-> reportTetherStateChanged(downstream active)
New:
CMD_NOTIFY_PREFIX_CONFLICT -> requestEnableTethering(false) ->
IpServer stopped -> reportTetherStateChanged(downstream inactive)
-> requestEnableTethering(true) -> IpServer started
-> reportTetherStateChanged(downstream active)

Test: atest MtsTetheringTestLatestSdk
Change-Id: Ibe22b300c56125359f4fa452bd01a0a2381fda23

Mark   commited 2023-10-26 09:28:22 +00:00
5cc386bdef
SyncSM07.1: Add a test that shows tethering restarts when disabling
When tethering restarts due to an IP conflict, it starts to
bring up downstream before its IpServer is completely disabled.

Test: atest TetheringTests
Change-Id: I0b0f0bf1bb9ac8421c05fe512d5082d095fa7180

Mark   commited 2023-10-26 09:26:37 +00:00
d81f6ef4db
SyncSM07: Replace IpServer's state machine with StateMachineShim
A simple replacement without changing any behavior.

Test: atest TetheringTests
Change-Id: I34903b57df68081e974163edec82a851ee4ccc98

Mark   commited 2023-10-26 09:26:15 +00:00
2150296476
SyncSM06: Add StateMachineShim
Test: atest StateMachineShimTest

Change-Id: Ic818aa55e7e0fd7a62dfce50a6ad719e6e1c44ec

Mark   commited 2023-10-26 09:24:55 +00:00
2ec1595d0b
Merge "Add a routing coordinator class" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-10-25 09:13:16 +00:00
4e47533688
Merge "Fix testRequestDownstreamAddressWithoutUsingLastAddress flaky" into main
Mark Chien   authored and   Gerrit Code Review   commited 2023-10-25 03:41:10 +00:00
cc26d678f2
Add a routing coordinator class
Test: In followup changes : RoutingCoordinatorManagerTest
Change-Id: Ia6811d614e02123a072c7638291828745abae051

Chalard Jean   commited 2023-10-24 22:12:26 +09:00
2fb66f1b28
Merge changes I427360f6,Ie6dbbe22 into main
* changes:
  SyncSM05.1: add testMultiDepthTransition
  SyncSM05: add SyncStateMachineTest

Mark Chien   authored and   Gerrit Code Review   commited 2023-10-24 06:50:43 +00:00
66ef9d35ce
Fix testRequestDownstreamAddressWithoutUsingLastAddress flaky
The problem is that the test releases mHotspotIpServer’s prefix before testing mUsbIpServer, which means that mUsbIpServer might choose the same address as mHotspotIpServer’s.

To fix this, we need to test that mUsbIpServer and mHotspotIpServer have different addresses before calling releaseDownstream(mHotspotIpServer).

Change-Id: Id7f7bbfeda841ec9b97e24c0f11893fa37b9ef54
Test: TH
Bug: 300127195

Mark Chien   commited 2023-10-24 06:16:03 +00:00
239860a4d6
SyncSM05.1: add testMultiDepthTransition
Test: atest TetheringTests
Change-Id: I427360f6a106b001123442ccd4802290d4f13369

Mark   commited 2023-10-23 07:34:29 +00:00
c352f3cb4e
SyncSM05: add SyncStateMachineTest
A initial test for SyncStateMachine, will add more tests in the
following changes.

Test: atest SyncStateMachineTest
Change-Id: Ie6dbbe22bfef40b1675d50243d14d0a235df1e3a

Mark   commited 2023-10-23 07:29:09 +00:00
8f068a8a1e
Reapply "Simplify addRoutesToLocalNetwork calls"
This reverts commit 316346be6e.

Change-Id: I86977f6e7a5451d037c7ea6fee5c4bc7082935ff

Chalard Jean   commited 2023-10-18 15:50:02 +09:00
7f2b3dabcd
Extend tethering enable/disable timeout to 30 seconds
The dnsmasq in R might block netd for 20 seconds, which can also
block tethering enable/disable for 20 seconds. To fix this, changing
the timeouts from 5 seconds to 30

Bug: 289881008
Test: TH
Change-Id: Ibed5895b2831465d454854d7250fcc44183596e2

Mark   commited 2023-10-17 06:09:45 +00:00
bb6ecfcd58
Revert "Simplify addRoutesToLocalNetwork calls"
Revert submission 2777667

Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/305187495

Reverted changes: /q/submissionid:2777667

Bug: 305187495

Change-Id: I516d40b20d775e9c61b2f825bc094329d016d0c3

Anton Kulakov   commited 2023-10-13 15:15:50 +00:00
316346be6e
Simplify addRoutesToLocalNetwork calls
There are only three calls to this method, and two of them
are with a list of 1 address which means it's simpler inlined.

The last call will be replaced with calls to RouteController
in a followup, meaning we addRoutesToLocalNetwork can be removed.

Test: RouterAdvertisementDaemonTest
      NetdUtilsTest
Change-Id: I3b6ee1db40f09954b336321000735a66306bf000

Chalard Jean   commited 2023-10-13 16:19:25 +09:00
cf70df3e9b
Stop the created handler threads on the tests
The created handler thread will stay there for a while until
all the tests are finished. This is considered as a leakage
which will take the resource from the devices. In low end
devices, this may possibly impact the performance. The created
threads should be closed explicitly.

Test: atest ConnectivityCoverageTests ConntrackSocketTest
Change-Id: Ic1beb2a210e7c8c80c66fc9e0727c47599150672

Paul Hu   commited 2023-10-12 10:25:03 +08:00
ebbbf8f470
Merge "Decouple Ipv6UpstreamRule with Ipv6DownstreamRule" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-10-02 05:33:48 +00:00
2a6a7359b7
Decouple Ipv6UpstreamRule with Ipv6DownstreamRule
Currently, Ipv6UpstreamRule is added follows the adding of
Ipv6DownstreamRule when it is the first rule from a downstream
interface to the upstream interface.

This CL changed it to:
1. Upstream interface change updates both IPv6 upstream and downstream
   forwarding rules.
2. Neighbor events updates only IPv6 downstream forwarding rules.

Data limit setting on the upstream interface is now depend on the
upstream rules instead of the downstream rules. This CL also updates
corresponding test cases in IpServerTest and BpfCoordinatorTest.

Test: atest TetheringTests
Bug: 261923493
Change-Id: I5b4df64a3d276afb7a24bbef3a0432f53377e8b2

KH Shi   commited 2023-09-19 08:02:24 +00:00
701c3ca2f5
Merge "Fix EthernetTetheringTest#testLocalOnlyTethering flaky" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-09-14 17:40:06 +00:00
47158c98b5
Add test for downstream tethering
Add end-to-end testing for testing NsdManager advertising and
discovering works fine with downstream tethering interfaces.

Bug: 281639507
Test: atest NsdManagerTest
Change-Id: I5a66423f216cfe0c82db5128502c885980ab264b

Yuyang Huang   commited 2023-09-12 17:53:37 +09:00
fca402abed
Remove unnecessary arguments from isTetheringFeatureEnabled
This CL also updates not to use isTetheringFeatureEnabled for
TETHER_FORCE_UPSTREAM_AUTOMATIC_VERSION which is wrongly configured in
Connectivity namespace.

Test: m
Bug: 279108992
Change-Id: If4f3a57c749bbaeb85454c31248c5bc5feaab936

Motomu Utsumi   commited 2023-09-08 16:11:28 +09:00
3e0be398a2
Fix EthernetTetheringTest#testLocalOnlyTethering flaky
The testLocalOnlyTethering only verifies whether an IPv6 RA
with a ULA prefix is sent out. If the test interface is killed
after the RA is sent out while the DHCP server is starting,
the error callback with exception is raised. RunDhcp
verification is used to ensure that DHCP server is started.

Bug: 286701571
Test: TH

Change-Id: Iccebcedbba7b2f9cd28bb1cc06af928ff8dfaaca

Mark   commited 2023-09-05 06:14:21 +00:00
801079f25a
Remove duplicated bpf offload support check in IpServer
In current code, IpServer will ensure bpf offload is supported before
calling BpfCoordinator's APIs. But those APIs already have the same
checks inside the function. This CL removed duplicated checks in
IpServer.

After this change, the BPF offload support status is only determined
inside BpfCoordinator and it won't change during the life cycle of
Tethering. Tethering initializes mBpfCoordinator just once in the
constructor. After that point, the value of isUsingBpf can never
change, because mIsBpfEnabled is final and
mBpfCoordinatorShim.isInitialized() is either always true (api30) or
can either never change (api31).

Also fixed a bug in IpServerTest upon this change.

Test: atest TetheringTests
Bug: 261923493
Change-Id: I50f231a83bf678b90eae4fd9bfa6035e86978bb3

KH Shi   commited 2023-09-01 07:37:18 +00:00
e4d549ab11
Merge "Introduce Ipv6UpstreamRule to bpf tethering offload" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-08-25 10:20:20 +00:00
480d807057
Introduce Ipv6UpstreamRule to bpf tethering offload
Replaced startUpstreamIpv6Forwarding and stopUpstreamIpv6Forwarding
with add/remove Ipv6UpstreamRule. This is a preparation for following
CLs which will pass the upstream's prefixes to the bpf map. We might
have more than one upstream rules.

Also renamed Ipv6ForwardingRule to Ipv6DownstreamRule since we have
defined the Ipv6UpstreamRule.

No logic changes are being made in this CL.

Test: atest TetheringTests
Bug: 261923493
Change-Id: I022f97c2daf468bbd4a4279a069ccf498013e7e7

KH Shi   commited 2023-08-24 12:02:23 +00:00
59ad35ee19
Move ArpPacket.java to frameworks/libs/net
Bug: 281639507
Test: TH
Change-Id: I754c3581438d716d2156b80e4ce29b3f2adf76d4

Yuyang Huang   commited 2023-08-23 18:24:35 +09:00
5c2126ed38
Merge "Add tests for OffloadHardwareInterface" into main
KH Shi   authored and   Gerrit Code Review   commited 2023-08-14 02:13:23 +00:00
839cc0b455
Merge "Import RFC7421_PREFIX_LENGTH from NetworkStackConstants." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-08-10 13:07:20 +00:00
b8ea09efd7