This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.
For more details please refer to the link below,
<add g3 doc link>
Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Add a utility to reconnect mobile data, and refactor toggleWifi to match
it.
The new reconnectWifi utils do not support turning wifi on and back off
anymore, but this was dead code as no test was using it (wifi is
supposed to be connected before starting tests).
Bug: 253698734
Test: atest
Change-Id: I2b8b8d186d05bb57c6a45d872febc54def8c6d59
The logic is currently disabled by default, adding a flag so
that we can compare result with A/B rollout. Tethering only read
this flag once when it is created.
Bug: 319212113
Test: atest TetheringTests
Change-Id: I656b0389e56d29dd691738ee3abfa6418746846f
This reverts commit cf11be9eb2.
Reason for revert: avoid some IpServer(s) running the new sync state machine while others use the async state machine.
Bug: 319212113
Change-Id: Ib086a7ccd102f38e579c79f94aceae9971f1853a
Mark Chienauthored and Markcommited 2024-01-22 11:34:14 +00:00
This change includes:
1. Refactor the logic in Tethering#dump into utils class.
2. Move the utils class to a common place which could be referenced
from other sub-modules.
3. Add @MonitorThreadLeak annotation to enforce
there is no thread leak problem.
Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345
Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3
The first tethering test case might have a tethering restart when
handling IP conflicts. Currently, we start a hotspot once before
tethering, but the test is still flaky in Cuttlefish because it
doesn't support hotspots. Instead, we'll start ethernet tethering.
Bug: 254183718
Test: atest CtsTetheringTest
Change-Id: I695d4e1b3f961893bc30b3144faf7ad7d2d70574
Markauthored and Mark Chiencommited 2023-12-27 08:57:57 +00:00
Before making enableEthernetTethering a static function, make its
dependency variable static.
Bug: 254183718
Test: atest CtsTetheringTest
Change-Id: Id3781d67b3abc69b146fa704d4795bcfb2431a2a
Markauthored and Mark Chiencommited 2023-12-27 03:50:32 +00:00
The logic is currently disabled by default, adding a flag so
that we can compare result with A/B rollout.
Test: atest TetheringTests
Change-Id: If640b9a172b97aa67c49b2976cdef118218f1e0f
This fix the code review comment from aosp/2319853 that getXXX functions
should be renamed to makeXXX because it's actually creating the object.
Test: TH
Change-Id: Ife8e1cc3a90b835764a2dd9731388b05d8a5c964
Markauthored and Mark Chiencommited 2023-12-04 09:02:55 +00:00
Currently, PrivateAddressCoordinator always selects the /24 prefix
from the 192.168.x.x/16 range first. If the upstream is also a /24
prefix in the 192.168.x.x/16 range, there's a 1/256 chance of a
conflict (192.168.0.x/24 ~ 192.168.255.x/24). Since 192.168.x.x/16
is a popular range for home and small business networks, we should
randomize the starting prefix range to reduce the chance of a
conflict. The /8, /12, and /16 range selection rates are 0.39%,
5.86%, and 93.7%, respectively (see the inline comments for how
the rates are calculated).
The chance of selecting a /24 prefix is:
- 10.0.0.0/8: 1/(256*256) * 93.7% = 0.001429%
- 172.16.0.0/12: 1/(16*256) * 5.86% = 0.00143%
- 192.168.0.0/16: 1/256 * 0.39% = 0.001523%
Note: This change is currently turned off by the
tether_force_random_prefix_base_selection flag. We'll run experiments
to make sure tethering stays reliable with this change enabled.
Bug: 312647670
Test: atest TetheringTests
Change-Id: Iea03fdcf0fccad95410e79ae87fcb046d75da457
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
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
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
ArraySet is designed to be more memory afficient than HashSet. It is
suitable to store small numbers of items.
Test: atest TetheringPrivilegedTests TetheringIntegrationTests \
TetheringTests
Bug: 261923493
Change-Id: I2bd2eded801cc05ce53ef9f9486b13faf1772d22
The test doesn't explicitly call adoptShellPermissionIdentity anymore. Instead it use runAsShell everywhere. Remove the dead code.
Bug: 254183718
Change-Id: Ia949e0e315a3b3ae915752e95ef9fe896fdc0f5b
Test: TH
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
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 Żenczykowskiauthored and Gerrit Code Reviewcommited 2023-10-28 02:10:52 +00:00
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
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
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
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