Commit Graph

1119 Commits

Author SHA1 Message Date
Junyu Lai
69bc4fede1 Merge "[SP32] Try to get 1.1 OffloadControl hardware if available" 2021-06-22 20:31:18 +00:00
Mark Chien
cec294d1b4 Merge changes I270ff43c,Ifc7eee24
* changes:
  Add enable and disable ip serving common functions
  Allow to use ncm function for usb tethering
2021-06-21 10:56:45 +00:00
Remi NGUYEN VAN
cc79d7c0f8 Merge "Add connectivity coverage tests" 2021-06-21 10:55:33 +00:00
Remi NGUYEN VAN
ec48bb82aa Merge "Allow mocking permission in TetheringServiceTest" 2021-06-21 10:19:07 +00:00
markchien
76e2e1c702 Add enable and disable ip serving common functions
This is a op CL which prepare for refactor.

Bug: 185649441
Bug: 189410000
Bug: 178116595

Test: atest TetheringTests
Change-Id: I270ff43c01736b9d18bd40a8e88e1379e9e4e863
2021-06-18 21:35:40 +08:00
markchien
cab01b7ebc Allow to use ncm function for usb tethering
Adding the configuration to decide using rndis or ncm for usb tethering.
If ncm is configured for TETHEIRNG_USB, then TETHERING_NCM is not
available.

Bug: 162920185
Test: atest TetheringTests
      manul testing usb tethering
Change-Id: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
2021-06-18 11:20:26 +08:00
Lorenzo Colitti
a8afcd3b0e Merge "Correctly dump IPv4 downstream flows." 2021-06-16 11:15:30 +00:00
Remi NGUYEN VAN
fe20e1317d Add connectivity coverage tests
The coverage tests will allow measuring code coverage for all
Connectivity+Tethering code.

This is a combination of the current TetheringCoverageTests, and
FrameworksNetTests.

Adding min_sdk_version to the test prevents it from using deprecated
IoUtils utilities. Replace it with the non-deprecated alternative.

Test: atest ConnectivityCoverageTests
Change-Id: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383
2021-06-16 19:45:20 +09:00
Remi NGUYEN VAN
0ae7e5bdcd Allow mocking permission in TetheringServiceTest
The test will currently fail if it is run in a package that has
ACCESS_NETWORK_STATE. Add utilities to mock permissions, and mock the
ACCESS_NETWORK_STATE permission to be denied.

Bug: 187935317
Test: atest TetheringServiceTest
Change-Id: I8df5f2ac21bf0314098e8c2e5ba583676ae8ab38
2021-06-16 17:53:10 +09:00
Lorenzo Colitti
8569168eda Correctly dump IPv4 downstream flows.
The current code does not print these correctly: it prints the
public address twice and then the NAT address. Fix this to print
the src, nat, and dst addresses.

Also dump the output MAC address.

Example output:

    IPv4 Upstream: [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
      [66:f1:6f:d8:66:0a] 31(31) 192.168.146.173:48594 -> 11(rmnet_data1) 100.100.109.185:48594 -> 8.8.8.8:853 [00:00:00:00:00:00] 32305ms
      [66:f1:6f:d8:66:0a] 31(31) 192.168.146.173:45806 -> 11(rmnet_data1) 100.100.109.185:45806 -> 8.8.4.4:853 [00:00:00:00:00:00] 32305ms
    IPv4 Downstream: [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
      [00:00:00:00:00:00] 11(rmnet_data1) 8.8.8.8:853 -> 31(31) 100.100.109.185:48594 -> 192.168.146.173:48594 [0e:a8:7f:ba:76:48] 32305ms
      [00:00:00:00:00:00] 11(rmnet_data1) 8.8.4.4:853 -> 31(31) 100.100.109.185:45806 -> 192.168.146.173:45806 [0e:a8:7f:ba:76:48] 32305ms

Test: manual
Bug: 190783768
Change-Id: I93a82064c95027c7c63cb30baf8482ecddcbd09d
2021-06-15 23:11:27 +09:00
Anton Hansson
ee350966fa Merge "Add tethering bootclasspath fragment to its sdk" 2021-06-15 13:11:44 +00:00
Lorenzo Colitti
70f43ee58e Improve dumping IPv4 map entries.
1. Dump both upstream and downstream rules.
2. Also dump rule last used time.

Test: manual
Bug: 190783768
Change-Id: I3fffbf4a5dea68e61349de8b41bea49b8a319f86
2021-06-15 12:54:08 +09:00
Lorenzo Colitti
704b8013f1 Dump underlying BPF traffic stats as well as higher-level stats.
This provides a better way to tell whether traffic is flowing.

Test: manual
Bug: 190783768
Change-Id: If557b0a18fc0aea1bf6a65d91547fc1930098ed0
2021-06-15 12:49:07 +09:00
Anton Hansson
a12ffacf6c Add tethering bootclasspath fragment to its sdk
This subsumes the java_sdk_library in the sdk.

Bug: 188427719
Test: build_mainline_modules.sh
Change-Id: Ib2ebb3893135b4dd91812f1f1b0915540cfd64cb
Merged-In: Ib2ebb3893135b4dd91812f1f1b0915540cfd64cb
(cherry picked from commit 3669599dec)
2021-06-14 19:23:49 +01:00
Maciej Żenczykowski
23f5d805ed import copy of bpf_net_helpers.h from system/netd/bpf_progs
after this:
  diff system/netd/bpf_progs/bpf_net_helpers.h packages/modules/Connectivity/Tethering/bpf_progs/bpf_net_helpers.h
shows no diff, besides a switch to '#pragma once'
as the include guard.

Test: builds, atest, TreeHugger
Bug: 177884581
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib943321d46254ba64ce206fb9e3b3414d15e4d45
2021-06-09 19:53:13 -07:00
Lorenzo Colitti
a3f12dd52c Merge "Don't send onLinkPropertiesChanged after onLost for 464xlat." 2021-06-09 07:59:25 +00:00
Mark Chien
7648833bd4 Merge changes Ib8fe719f,Ia8c05780
* changes:
  Suppress IpServer message logs
  Remove *Locked wording
2021-06-08 10:02:44 +00:00
markchien
21021efbe1 Suppress IpServer message logs
To avoid log flooding, suppress CMD_IPV6_TETHER_UPDATE and
CMD_NEIGHBOR_EVENT message log because they appear frequentlg and
don't have any content which means they are ueseless for debugging.
Also remove logMessage from BaseServingState to fix duplicated
message because all the message already log in TetheredState
and LocalHotspotState which inherit BaseServingState.

Bug: 162920185
Bug: 185649441
Test: atest TetheringCoverageTests
      atest MtsTetheringTestLatestSdk
      atest CtsTetheringTest
Change-Id: Ib8fe719f3c1c4a65e6b5152df5e5adf33aba2079
2021-06-08 15:57:04 +08:00
markchien
dc5903ae56 Remove *Locked wording
Since tethering run in single thread without any synchronized lock,
remove "Locked" wording from the methods which the use lock before.

Bug: 162920185
Test: atest TetheringCoverageTest
Change-Id: Ia8c057800cab30cdcbacae4db2d706b6427e9861
2021-06-08 15:56:14 +08:00
Lorenzo Colitti
b4bf015b57 Don't send onLinkPropertiesChanged after onLost for 464xlat.
Currently, when a network that uses 464xlat is torn down,
NetworkCallbacks will receive onLinkPropertiesChanged after
onLost. This is confusing and incorrect.

The incorrect callback is sent because handleLinkProperties
checks that the netId of the agent still exists, not that the
NetworkAgent is still registered. This is normally correct,
because the NetworkAgent is removed from mNetworkAgentInfos and
the netId are removed from mNetworkForNetId by the same method,
disconnectAndDestroyNetwork.

In this specific case it's not correct, because the call to
handleUpdateLinkProperties is from disconnectAndDestroyNetwork
itself via nai.clatd.update and calls Nat464Xlat#stop.

No other callers of handleUpdateLinkProperties are affected
because:

- EVENT_NETWORK_PROPERTIES_CHANGED is called only by
  maybeHandleNetworkAgentMessage, which first checks that the
  NetworkAgent is registered.
- handlePrivateDnsSettingsChanged only looks at registered
  NetworkAgents (it loops over mNetworkAgentInfos).
- handlePrivateDnsValidationUpdate, handleNat64PrefixEvent and
  handleCapportApiDataUpdate call getNetworkAgentInfoForNetId,
  which will correctly determine that the agent is no longer
  registered, since they run on the handler thread and thus
  cannot run at the same time as disconnectAndDestroyNetwork.

The existing code contains a check for the netId being current.
This is intended to ensure that an update from a NetworkAgent
cannot affect another agent with the same Network. This extra
check is not necessary, because code running on the handler
thread can never observe a NetworkAgent in mNetworkAgentInfos
unless mNetworkForNetId maps that NetworkAgent's Network to that
NetworkAgent. This is because mNetworkForNetId is updated by the
same methods as mNetworkAgentInfos, and those updates occur on
the handler thread. So all code on the handler thread will see
those two as consistent.

Bug: 176496580
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
2021-06-08 15:48:57 +09:00
Remi NGUYEN VAN
f20103940e Reference framework-connectivity stubs explicitly
To merge the framework-connectivity and framework-connectivity.impl
targets, framework-connectivity stubs need to be referenced explicitly
in java_sdk_libraries, otherwise the build system will currently see
dependency cycles.

Bug: 183600168
Test: m
Merged-In: I556747f9ba934f8b44b6ea9a518adbccc84ac2a9
Change-Id: I0ff10dcb553115d349e287c9f648d77579158f9d
2021-06-08 15:24:05 +09:00
Chiachang Wang
02eea987c0 Merge changes I5d3e448e,Id69ac1d3
* changes:
  Add test for ConnectivityManager.factoryReset
  Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
2021-06-02 01:24:10 +00:00
Treehugger Robot
c4d26414f8 Merge "Test tethered callback with TetheringInterface" 2021-06-01 14:35:48 +00:00
Treehugger Robot
414edc4ac9 Merge "Add the tethering type to TetheringEventCallback methods" 2021-06-01 14:33:51 +00:00
Aaron Huang
87f051bfa6 Merge "Add required permission to Tethering" 2021-06-01 10:13:34 +00:00
Chiachang Wang
4f5c4c4323 Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.

Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
2021-06-01 15:08:48 +08:00
markchien
3a23d2e2a6 Test tethered callback with TetheringInterface
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
      atest CtsTetheringTestLatestSdk on R
      atest MtsTetheringTestLatestSdk on S and R
Merged-In: I2a0b8c43fb340c3eaed7f0f90464199222a24280
Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280
2021-06-01 14:36:09 +08:00
markchien
35ad54b25e Add the tethering type to TetheringEventCallback methods
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S

Merged-In: I91bcccd676d109c1b974497ac29bd366a41b8899
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899
2021-06-01 14:35:39 +08:00
Remi NGUYEN VAN
43740568b6 Merge "Revert "Add owners block for migration"" 2021-06-01 00:05:06 +00:00
Remi NGUYEN VAN
b22e9ad95d Revert "Add owners block for migration"
The migration is now done.
Modification in revert: kept tests/OWNERS deleted.

Bug: 189375701
Change-Id: Ie105882fc61f7395f2e37711d4849c63e1f7199d
2021-05-31 10:34:04 +00:00
Anton Hansson
f827199767 Merge "Include sdk versioning proto in tethering apex" 2021-05-27 10:05:22 +00:00
Anton Hansson
db3b06959f Include sdk versioning proto in tethering apex
Allows SdkExtensions to inspect its version to decide what the extension
sdk version is on-device.

Bug: 188787081
Test: m com.android.tethering and inspect
Merged-In: If2d28b02be871594fed1fbb40b7aad284b553afb
Change-Id: If2d28b02be871594fed1fbb40b7aad284b553afb
2021-05-27 07:35:31 +00:00
Remi NGUYEN VAN
89bd526eba Add owners block for migration
The migration will merge history in downstream branches,
so changes should not be submitted in the meantime.

Bug: 189375701
Change-Id: I32d4c6a2d7344b1baf92eeac27b3cbbecd549c2d
Test: TH
2021-05-27 01:13:44 +00:00
Aaron Huang
3f69f1c418 Add required permission to Tethering
The permission of Tethering is moved to a separate xml file,
add the xml module to the required field of tethering app.

Bug: 151213404
Test: TetheringTests
Merged-In: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
Change-Id: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
2021-05-26 23:29:55 +08:00
Nikita Ioffe
d2d0d82a1d Merge "Mark tethering apex as compressible" 2021-05-26 10:29:16 +00:00
Maciej Żenczykowski
fc592e8bc0 Merge "Fix memory access violation in NetworkStack" 2021-05-24 23:56:06 +00:00
Remi NGUYEN VAN
e107f26c5d Merge "Merge history of packages/Connectivity" 2021-05-24 23:32:43 +00:00
Ye Jiao
86f56a135a Fix memory access violation in NetworkStack
Fix memory access violation in com_android_networkstack_tethering_BpfUtils.cpp
caused by invalid format string in com_android_networkstack_tethering_BpfUtils_isEthernet.
If rv is not valid, jniThrowException will format a string using
"Unknown hardware address type %s on interface %s". However, rv is an int but here
"%s" is used in fmt string, thus causing access violation of memory.

Use "%d" instead of "%s" for int.

Bug: 188757793
Change-Id: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
2021-05-24 06:12:56 +00:00
Baligh Uddin
3684713b8a Merge history of packages/Connectivity
Modified License Import for:
- Tethering/common/TetheringLib/Android.bp
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp

BUG: 186628461
TEST: TH
Merged-In: I7b5fd61cd551c7010f5b8ceabbfdd04f30f648dd
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ia2185820f485e8ad2d3626a96eab7f5a874736cf
2021-05-24 05:45:18 +00:00
Mark Chien
011552cc54 Merge "Disable tryCell when UpstreamMonitor stop" 2021-05-24 02:27:13 +00:00
markchien
89f2670b65 Disable tryCell when UpstreamMonitor stop
tryCell configuration would not be force disabled UpstreamMonitor stop.
If tethering stop with using mobile upstream and swap with SIM fron no
dun to dun supported, dun request would be filed even tethering is not
active.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I5505655f52da9fdca2fd43a58e043a9ab727741d
2021-05-21 20:35:11 +08:00
Junyu Lai
ff77e99cf0 Merge "Fix TetheringTest crash on eng build" 2021-05-21 02:40:13 +00:00
Treehugger Robot
d9de9d783b Merge "Add bootclasspath_fragment." 2021-05-20 09:37:05 +00:00
Treehugger Robot
7960575fab Merge "Update connectivity TEST_MAPPING" 2021-05-20 08:49:46 +00:00
Remi NGUYEN VAN
d954bfcd32 Update connectivity TEST_MAPPING
- Move Tethering TEST_MAPPING up one level to merge with the general
   Connectivity TEST_MAPPING. This allows running the tethering tests
   on any connectivity change.
 - Move TetheringIntegrationTests from postsubmit to presubmit
 - Add TetheringCoverageTests to mainline-postsubmit, so it can be
   added to mainline-presubmit later.
 - Import NetworkStack tests so that they are run on any connectivity
   change.

TetheringIntegrationTests were continuously green in postsubmit.

Bug: 187946226
Change-Id: Ibf05ad64b02c563930ba0f01eb91331b295fe505
Test: Treehugger needed to test TEST_MAPPING files
2021-05-20 01:26:51 +00:00
markchien
9eac605333 Fix tethering unit test fail in R
The change aosp/1708088 break tethering unit test in R.

Bug: 187946226
Test: atest TetheringTests in R and S
Change-Id: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
2021-05-19 22:58:36 +08:00
junyulai
7ba566dbf7 Fix TetheringTest crash on eng build
startTrackDefaultNetwork was allowed to called multiple times
before even though there is no one actually do it. However,
in the TetheringTest#verifyDefaultNetworkRequestFiled, a
manual invocation is used to ensure that function supports
multiple entrance.

But with aosp/1697371, startTrackDefaultNetwork is no longer
allowed to be called multiple times, it would lead to log.wtf
and crash system in eng build.

Since the manual invocation of startTrackDefaultNetwork is not
realistic and no longer valid anymore, remove the invocation
that caused the trouble.

Test: atest TetheringCoverageTests
Bug: 188613493
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
2021-05-19 16:23:13 +08:00
Mark Chien
84a8a13a92 Merge "Check whether feature is enabled by compare with apex version" 2021-05-18 03:09:20 +00:00
Mark Chien
a59a146b36 Merge "Test mts against last stable api level" 2021-05-14 09:00:11 +00:00
markchien
a3ef48117f Check whether feature is enabled by compare with apex version
Replace the isFeatureEnabled function which is check with apex version.

Bug: 187946226
Test: Set device config flag and check the result
Change-Id: Iba44a01e2fdd0698dcb338ea4a8fe8147cbaa7dd
2021-05-14 16:56:33 +08:00