Commit Graph

28280 Commits

Author SHA1 Message Date
Lorenzo Colitti
cd60e94a2c Merge changes I944f4c6a,I69cf58bc into sc-dev
* changes:
  Don't send onLinkPropertiesChanged after onLost for 464xlat.
  Improve test coverage for disconnecting networks with clat.
2021-06-14 05:51:54 +00:00
TreeHugger Robot
0ced5b5e8b Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev 2021-06-11 17:21:37 +00:00
Lorenzo Colitti
beb7d92cbc 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
Original-Change: https://android-review.googlesource.com/1727829
Merged-In: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
Change-Id: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
2021-06-11 13:46:33 +00:00
Lorenzo Colitti
cfa262d8b8 Improve test coverage for disconnecting networks with clat.
Ensure that NetworkCallbacks and netd operations are accounted
for. Also add a test for the spurious onLinkPropertiesChanged
callback that is currently send out after onLost.

Bug: 176496580
Test: atest ConnectivityServiceTest
Original-Change: https://android-review.googlesource.com/1729093
Merged-In: I69cf58bc87dfe55ea359a2cd76167d03fe2c953d
Change-Id: I69cf58bc87dfe55ea359a2cd76167d03fe2c953d
2021-06-11 13:44:46 +00:00
Bill Yi
d7ec12e91d Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ice6b9421c94bb6253595e955e9585eab2115ff61
2021-06-11 09:59:22 +00:00
Treehugger Robot
348d144786 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>
Original-Change: https://android-review.googlesource.com/1733033
Merged-In: Ib943321d46254ba64ce206fb9e3b3414d15e4d45
Change-Id: Ib943321d46254ba64ce206fb9e3b3414d15e4d45
2021-06-10 15:24:19 +00:00
TreeHugger Robot
3ea9a136fa Merge changes Ib8fe719f,Ia8c05780 into sc-dev
* changes:
  Suppress IpServer message logs
  Remove *Locked wording
2021-06-10 14:34:08 +00:00
Remi NGUYEN VAN
b81724602f Merge "Update TetheringTests for new connectivity shims" into sc-dev 2021-06-10 13:45:12 +00:00
Remi NGUYEN VAN
c94a1ffd55 Update TetheringTests for new connectivity shims
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.

To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.

Ignore-AOSP-First: topic needs differences in AOSP
Bug: 189581241
Test: atest TetheringTests
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
2021-06-10 13:44:00 +00:00
markchien
3b3d92ced0 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
Merged-In: Ib8fe719f3c1c4a65e6b5152df5e5adf33aba2079
2021-06-10 21:13:44 +08:00
markchien
8409a1c297 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
Merged-In: Ia8c057800cab30cdcbacae4db2d706b6427e9861
2021-06-10 21:13:07 +08:00
TreeHugger Robot
c056232f0e Merge changes I00d1aa47,Icffbe67f into sc-dev
* changes:
  Add CTS for AES-CMAC
  Add tests for new IPsec algorithms in IpSecManagerTest
2021-06-10 13:11:03 +00:00
Treehugger Robot
7fd2b373ff Fix restorePrivateDnsSetting with null hostnames
When private DNS setting was set to opportunistic (mode) and null
(hostname), CtsNetUtils would not restore it.

Make sure that private DNS settings are restored after every test. Also
fail if restore is called without having saved any setting beforehand.

Bug: 190465704
Test: atest CtsNetTestCases
Original-Change: https://android-review.googlesource.com/1729162
Merged-In: Ic5d8d8b729469e0eef89a0b53f166e604264c1ee
Change-Id: Ic5d8d8b729469e0eef89a0b53f166e604264c1ee
2021-06-09 10:05:18 +00:00
TreeHugger Robot
f15137fb9f Merge "Fix TetheringTest crash on eng build" into sc-dev 2021-06-09 07:57:25 +00:00
junyulai
9c5d40beca 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
Merged-In: I61f6088783d521fd17ae1e87370842b4239fbe75
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
  (cherry-picked from aosp/1711433)
2021-06-09 01:57:37 +00:00
Yan Yan
0dd6de5842 Add CTS for AES-CMAC
This commit:
  - Verify AES-CMAC is supported in device that first
      launched with SDK beyond R
  - Verify IpSecTransforms can be built with AES-CMAC and
      traffic flows

Bug: 171083832
Test: atest IpSecManagerTest
Test: AES-CMAC tests are manually enabled and verified
Change-Id: I00d1aa475033810a5f60f0e3fc692be87ff62e13
Merged-In: I00d1aa475033810a5f60f0e3fc692be87ff62e13
(cherry picked from commit 0891de6311)
2021-06-08 18:25:04 -07:00
Yan Yan
9447bbf6c6 Add tests for new IPsec algorithms in IpSecManagerTest
This CL adds CTS tests that:
- Verify IpSecAlgorithm#getSupportedAlgorithms
- Verify new algorithms are supported in device that first
  launched with SDK beyond R
- Verify IpSecTransforms can be built with new algortihms and
  traffic flows

Since there is no hardware that first launched with SDK beyond R
at the time of writing this CL, tests for new algorithms were
manually enabled and verified on the pixel with an updated kernel.

Bug: 171083832
Test: atest IpSecManagerTest
Change-Id: Icffbe67fca29b051457dbf863ba3aaf653806a83
Merged-In: Icffbe67fca29b051457dbf863ba3aaf653806a83
(cherry picked from commit 5e692b6ca7)
2021-06-08 18:24:04 -07:00
TreeHugger Robot
8e345e9637 Merge "Require location permission for ConnDiags WiFi only." into sc-dev 2021-06-08 15:18:54 +00:00
Treehugger Robot
27b6888364 Require location permission for ConnDiags WiFi only.
This CL updates ConnectivityDiagnostics permission checks in
ConnectivityService to only require location permission for Networks
that have TRANSPORT_WIFI. This change is consistent with the location
restrictions required for the transports themselves. Previously,
location permissions were required for all Network types.

Bug: 187310575
Test: atest ConnectivityServiceTest ConnectivityDiagnosticsManagerTest
Change-Id: I48806533e4e705d2d9be45f3b3d3931d9294b167
Merged-In: I48806533e4e705d2d9be45f3b3d3931d9294b167
(cherry picked from commit 0990af5148)
2021-06-07 22:17:05 +00:00
Anton Hansson
3669599dec 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
2021-06-07 15:46:33 +01:00
Nikita Ioffe
8148656efc Merge "Mark tethering apex as compressible" into sc-dev 2021-06-07 11:13:35 +00:00
Paul Hu
48fc715694 Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" into sc-dev 2021-06-07 09:29:56 +00:00
Paul Hu
9a8e4497a3 Merge "Address leftover comments" into sc-dev 2021-06-07 08:50:21 +00:00
Chiachang Wang
3d60a42323 Add test for ConnectivityManager.factoryReset
Bug: 186061922
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCasesLatestSdk on R and S device
Merged-In: I5d3e448ed00b9baeb64a08036ecac1f9c8206cc7
Change-Id: I5d3e448ed00b9baeb64a08036ecac1f9c8206cc7
2021-06-04 13:29:54 +00:00
Chiachang Wang
0acaa74538 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
Megred-In: Id69ac1d30ab2bbf23e870193335b139f54672636
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
Ignore-AOSP-First: cherry-pick
2021-06-04 13:29:38 +00:00
Paul Hu
87f2897f90 Merge "Implement mobile data preferred uids feature" into sc-dev 2021-06-04 08:55:31 +00:00
paulhu
71ad4f1175 Implement mobile data preferred uids feature
- Read MOBILE_DATA_PREFERRED_UIDS setting when system ready
- Register MOBILE_DATA_PREFERRED_UIDS setting observer
- Send uid ranges to netd when update mobile data preferred uids

Bug: 171872461
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I5153c770650594e05dfa8cf230d7381d790f4a55
2021-06-02 15:40:53 +08:00
paulhu
a1ac564748 Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting
Now, PermissionMonitor reigster observer to listen the change
from all users, but "uids allowed on restricted networks" should
affect to all users instead of per each user. Thus, move the
setting from Settings.Secure to Settings.Global.

Bug: 189705071
Test: atest FrameworksNetTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: Ibea354d8dda1f02652a193820f3f9eb573b9a956
2021-06-01 21:28:34 +08:00
paulhu
5d8340f7ae Address leftover comments
- Add comment to highestPermissionForUid()
- Add testAppsAllowedOnRestrictedNetworksChangedMultipleUsers
- Add synchronized to guard mUidsAllowedOnRestrictedNetworks
  access.

Bug: 189705071
Test: atest FrameworksNetTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: I9056758db15e8a21b84ef244d4cacf24c3b79894
2021-06-01 19:04:28 +08:00
Aaron Huang
059ddb4025 Merge "Remove framework-connectivity-annotations library" into sc-dev 2021-06-01 08:08:21 +00:00
TreeHugger Robot
98c351f429 Merge changes I81bf8969,I2edba513,Ibb913979 into sc-dev
* changes:
  Add CTS for NetworkScore.setTransportPrimary
  Add some CTS tests for NetworkScore.
  Add a first CTS for NetworkScore
2021-06-01 07:41:17 +00:00
Aaron Huang
cff22949d2 Remove framework-connectivity-annotations library
This library can be removed because the annotations are no longer
used out of module.

@RestrictBackgroundStatus and @MultipathPreference are defined
in connectivity mainline module. Annotate these in non-updatable
platform is not going to be manageable long term. For example,
if the module gets updated and the annotation gets more values
then it's a problem in non-updatable platform. So, it should
not have IntDef cross module boundaries.

Ignore-AOSP-First: AOSP doesn't include this change yet
Bug: 183972925
Test: build
Change-Id: I63f1fde73c4ffdaff9fda914e33cbb5a110ba64e
2021-06-01 06:47:47 +00:00
Chalard Jean
ee93b3d3b3 Add CTS for NetworkScore.setTransportPrimary
Ignore-AOSP-First: NetworkScore incomplete in AOSP
Bug: 184037351
Test: this
Change-Id: I81bf8969ace3cb6826b30c5bbd0b896c64c73c57
2021-06-01 02:20:57 +00:00
Chalard Jean
2d2ecc3cfb Add some CTS tests for NetworkScore.
Ignore-AOSP-First: NetworkScore incomplete in AOSP
Bug: 184037351
Test: this
Change-Id: I2edba51351cd4c71727663aa85b1d5141bff2a15
2021-06-01 02:20:54 +00:00
Chalard Jean
aac204b202 Add a first CTS for NetworkScore
In an effort to make reviewing easier, this implements most of
the infra but only a mostly trivial test.

Ignore-AOSP-First: NetworkScore incomplete in AOSP
Bug: 184037351
Test: this
Change-Id: Ibb9139798ce44d748e87bae79a1e23311ec8d9b6
2021-06-01 02:20:26 +00:00
Chiachang Wang
1084882539 Merge "Unify the verification for unregister a NetworkAgent" into sc-dev 2021-06-01 02:09:37 +00:00
TreeHugger Robot
1dc094b2c0 Merge "Fix memory access violation in NetworkStack" into sc-dev 2021-05-31 08:02:13 +00:00
Nikita Ioffe
5f33357348 Mark tethering apex as compressible
Bug: 178713634
Test: presubmit
Change-Id: I621305e47b5b86408a72c622b1e367cd0e75f82c
Merged-In: I621305e47b5b86408a72c622b1e367cd0e75f82c
(cherry picked from commit 31cef5ebe2)
2021-05-27 15:21:33 +01:00
Remi NGUYEN VAN
1af06c78df Merge fixed history of Connectivity
BUG: 189375701
TEST: TH
Ignore-AOSP-First: per-branch merges

Merged-In: Ie3a058b904cb2e3704c3a0725c8f720f81bb235e
Merged-In: Ib95d84b91a455d1a5f10cbf3f8c08c0459bc1c7c
Merged-In: I37e52cf7d59b6dbcd77879725385c7940318b835
Change-Id: I12a430eda6d4b489cbd51369ab215e632833155c
2021-05-27 17:10:24 +09:00
Orion Hodson
13f6148e22 Merge "Use updated NetworkEventDispatcher API" into sc-dev 2021-05-26 13:34:07 +00:00
Lorenzo Colitti
962e174260 Merge "Update allowed on restricted networks getter/setter" into sc-dev 2021-05-26 12:18:03 +00:00
paulhu
68aacb407a Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb
2021-05-26 16:16:57 +08:00
Orion Hodson
1f4fa9ffd5 Use updated NetworkEventDispatcher API
Bug: 185153775
Ignore-AOSP-First: addressing API council comments with deadline
Test: m
Change-Id: Iae3cec4f751e1f74ccd26db6f22f55cf21dfc04a
2021-05-25 21:25:17 +01:00
Anton Hansson
89eb55fb8a 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
Ignore-AOSP-first: internal topic, will cherry-pick after submission
Change-Id: If2d28b02be871594fed1fbb40b7aad284b553afb
2021-05-25 13:01:31 +01:00
Maciej Żenczykowski
365ada7e04 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
Original-Change: https://android-review.googlesource.com/1715797
Merged-In: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
Change-Id: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
2021-05-25 08:01:17 +00:00
Bill Yi
58b943a701 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I764f64b9ce1284955530e1c1b40c6441691845e2
2021-05-24 18:12:15 -07:00
Chiachang Wang
ecd0886e36 Unify the verification for unregister a NetworkAgent
It's a follow up of aosp/1652210.

The tests may verify partial NetworkAgent callback behavior.
The existing expectCallback will always expect to see the first
callback in the callback queue, so if tests did not verify all
the happened callback. It cannot verify the callback after
unregister. Add eventuallyExpect to wait for a target callback
and skip the disinterest ones, and verify the unregister
behavior for NetworkAgent callback in one method.

Bug: 178725261
Test: atest android.net.cts.NetworkAgentTest
Change-Id: I66d8e5a0fa1e2245711e8ac90d9daca24802e399
Merged-In: I66d8e5a0fa1e2245711e8ac90d9daca24802e399
(cherry picked from commit 12a6422f47)
2021-05-25 01:03:13 +00:00
Baligh Uddin
2afd0986d3 Merge history of packages/Connectivity
Modified Visibility / Includes for:
- Tethering/common/TetheringLib/Android.bp

Modified License Import for:
- 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
Modified Lint mapping for:
- framework/lint-baseline.xml
- service/lint-baseline.xml

BUG: 186628461
TEST: TH
Merged-In: Ie82d0fb34bda77543e31c82660c6f315efa87f62
Change-Id: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-05-24 04:40:14 +00:00
TreeHugger Robot
a871b452a6 Merge changes I1de322c9,Id0983d4b into sc-dev
* changes:
  Improve IKEv2/IPsec VPN by proposing more IPsec algorithms
  Improve IKEv2/IPsec VPN by proposing more IKE algorithms
2021-05-22 05:05:51 +00:00
TreeHugger Robot
958fe9a51d Merge changes I1de322c9,Id0983d4b into sc-dev
* changes:
  Improve IKEv2/IPsec VPN by proposing more IPsec algorithms
  Improve IKEv2/IPsec VPN by proposing more IKE algorithms
2021-05-22 05:05:51 +00:00