Commit Graph

28976 Commits

Author SHA1 Message Date
Treehugger Robot
ac39fac427 Fully setup test TUN iface on create. am: 5cbd7b38ca
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14969443

Change-Id: I6937e841f5213cc6a5705853a44ca7e519158d44
2021-06-15 04:50:05 +00:00
Treehugger Robot
5cbd7b38ca Fully setup test TUN iface on create.
This CL updates TestNetworkService to fully setup test TUN
interfaces when created. Previously, the interface was only
created in netd when the Test Network was created.

Bug: 182291467
Bug: 189125789
Test: atest Ikev2VpnTest IpSecManagerTunnelTest
Change-Id: I4c1262e566517bbb03dd610f595e4d18bc4e7735
Merged-In: I4c1262e566517bbb03dd610f595e4d18bc4e7735
(cherry picked from commit 615237a818)
2021-06-14 20:46:52 +00:00
Paul Hu
98ab75c109 Merge "Add DEFAULT_NETWORK_PRIORITY constants" into sc-dev am: dcba997adf
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731886

Change-Id: I1226c1d512e252ebbbde56e1d144e0072e941e43
2021-06-14 15:36:35 +00:00
Paul Hu
dcba997adf Merge "Add DEFAULT_NETWORK_PRIORITY constants" into sc-dev 2021-06-14 15:17:23 +00:00
Paul Hu
fccce46a7c Merge "Add more unit tests for mobile data preferred uids feature" into sc-dev am: 7d5fa3da7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731884

Change-Id: I89634550c0e426be5419ffcc2ff066225446aa5a
2021-06-14 14:48:29 +00:00
Paul Hu
7d5fa3da7d Merge "Add more unit tests for mobile data preferred uids feature" into sc-dev 2021-06-14 14:29:29 +00:00
Lorenzo Colitti
e85cf9b23d Merge changes I944f4c6a,I69cf58bc into sc-dev am: cd60e94a2c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14935383

Change-Id: I580752faf2023115140dfecd1b6de09392203a4d
2021-06-14 06:05:00 +00:00
Lorenzo Colitti
8c0aaba806 Improve test coverage for disconnecting networks with clat. am: cfa262d8b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14935382

Change-Id: I081e690c3d3afd1bd0e73d2869172d229863baef
2021-06-14 06:04:58 +00:00
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
d033292467 [automerger skipped] Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev am: 0ced5b5e8b -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14945623

Change-Id: I312ea41fb1556dcfc23d1ce2ec2e214022a90f79
2021-06-11 17:35:44 +00:00
TreeHugger Robot
0ced5b5e8b Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev 2021-06-11 17:21:37 +00:00
TreeHugger Robot
f259e4fa82 Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-v2-dev 2021-06-11 17:00:32 +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
e421b1eaad Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ie74e329e714a4399f121546b858154098e8c60c0
2021-06-11 10:00:29 +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
paulhu
c2198778ab Add DEFAULT_NETWORK_PRIORITY constants
- Add default network priority to NetworkRequestInfo.
- The default network priority value is used when issue uid
  ranges rules to netd. Netd will use the priority value and uid
  ranges to generate corresponding ip rules specific to the given
  network preference.

Bug: 171872461
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I0ea71b348492aeb4784d487bed4cfd5d387426ba
2021-06-11 14:22:33 +08:00
Treehugger Robot
5bfdca6367 import copy of bpf_net_helpers.h from system/netd/bpf_progs am: 348d144786
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14937139

Change-Id: I4b34a9e6879db1d38f44d06f89a809802bf32aa1
2021-06-11 03:57:42 +00:00
paulhu
7ed70a944c Add more unit tests for mobile data preferred uids feature
- Add more tests for mobile data preferred uids.
- Also address leftover comments on implementation commit.

Bug: 171872461
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I63f65bffc1b8883ddfd774222e26e629d7ea1f94
2021-06-11 00:09:45 +08: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
532c1a2b5e Merge changes Ib8fe719f,Ia8c05780 into sc-dev am: 3ea9a136fa
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14779544

Change-Id: I11b73ce42cae4df5314ad58e0a92b4cb834b8ff1
2021-06-10 14:54:34 +00:00
markchien
dc664bd9e9 Remove *Locked wording am: 8409a1c297
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14673213

Change-Id: I54fea6433eeffd506378cb5246a0ab42fe4de680
2021-06-10 14:54:32 +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
a6255e6589 Merge "Update TetheringTests for new connectivity shims" into sc-dev am: b81724602f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14928587

Change-Id: I0da9c2e6717256ea88176c836ea5b6ac67919a0a
2021-06-10 14:05:20 +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
TreeHugger Robot
6f249d2582 Merge changes I00d1aa47,Icffbe67f into sc-dev am: c056232f0e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14911203

Change-Id: I60f42848b46edcef0d29fa355c663ab08a586c4b
2021-06-10 13:30:55 +00:00
Yan Yan
9e754b2514 Add tests for new IPsec algorithms in IpSecManagerTest am: 9447bbf6c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14911202

Change-Id: I9e54e3021f0d938dfb07658e3677c62e3448bf66
2021-06-10 13:30:51 +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
4db91ab936 Fix restorePrivateDnsSetting with null hostnames am: 7fd2b373ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14911838

Change-Id: If1e643887b191942217d5589f933bd924c0ff849
2021-06-10 00:06:44 +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
04453f641a Merge "Fix TetheringTest crash on eng build" into sc-dev am: f15137fb9f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14637501

Change-Id: I8cd2c8a60e72f28aaf3b931ad7701263d8fd9b29
2021-06-09 08:14:54 +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
a58037af96 Merge "Require location permission for ConnDiags WiFi only." into sc-dev am: 8e345e9637
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14885895

Change-Id: Id07bf1a5714a717176d003758fdf9b31fde0833a
2021-06-08 15:32:49 +00:00
TreeHugger Robot
8e345e9637 Merge "Require location permission for ConnDiags WiFi only." into sc-dev 2021-06-08 15:18:54 +00:00
Anton Hansson
f61dc66a91 Add tethering bootclasspath fragment to its sdk am: 3669599dec
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14881273

Change-Id: Ib4b4fc6e684f30a1bb9e1d27813274e7701ceeaf
2021-06-08 09:18:34 +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
9f59763887 Merge "Mark tethering apex as compressible" into sc-dev am: 8148656efc
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14748198

Change-Id: I63b46890d67d85972a4d5ad0700d2917828f9fb6
2021-06-07 11:30:26 +00:00
Nikita Ioffe
8148656efc Merge "Mark tethering apex as compressible" into sc-dev 2021-06-07 11:13:35 +00:00
Paul Hu
6c3f2ea641 Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" into sc-dev am: 48fc715694
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14772857

Change-Id: I1d74e05699d3ccaf882b9f8cc9d78ac39dd4483c
2021-06-07 09:50:24 +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
b9d5a0b545 Merge "Address leftover comments" into sc-dev am: 9a8e4497a3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14772851

Change-Id: Ie3e82c84cdfe8a9ea6a01859501f67ea472bc969
2021-06-07 09:03:47 +00:00
Paul Hu
9a8e4497a3 Merge "Address leftover comments" into sc-dev 2021-06-07 08:50:21 +00:00
Chiachang Wang
1c016b7f07 Add test for ConnectivityManager.factoryReset am: 3d60a42323
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14840205

Change-Id: Ib7edfb23781ad9ca3a2f8b4d3847f1ed9b58e4fd
2021-06-07 04:15:49 +00:00