Commit Graph

29007 Commits

Author SHA1 Message Date
Lorenzo Colitti
e276a5c2e0 Cleanup commit to remove @SkipPresubmit and fix nits am: 74ded77039
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14991452

Change-Id: I342d1bbdd1f2a654a98d454f71a5e5e9654dba95
2021-06-16 12:00:03 +00:00
Lorenzo Colitti
7a1c1fee31 Verify kernel implementation of AES-CMAC am: c1a70345b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14991451

Change-Id: If2f59885fb8f8189138fa61e6d640bd19c8cb615
2021-06-16 11:59:54 +00:00
Lorenzo Colitti
816ff6966b Verify kernel implementation of AES-XCBC am: 69b777ccc8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14991432

Change-Id: I9d82303cd0b558e0c41f5f2fc1222ffa707ea6e9
2021-06-16 11:59:42 +00:00
Lorenzo Colitti
41d5080646 Verify kernel implementation of AES-CTR am: 816c800df3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14988702

Change-Id: I216c6ebe834839f8be089cf469a19045293452c2
2021-06-16 10:45:45 +00:00
Lorenzo Colitti
4d97e41293 Verify kernel implementation of ChaCha20Poly1305 am: 09527d67ca
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14988701

Change-Id: I096ae20fda86a2cc593b516079fd072183ba672e
2021-06-16 10:45:43 +00:00
Lorenzo Colitti
5935f1ea81 Support algorithm configurability in PacketUtils EspHeader am: 2e65e9fa88
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14990605

Change-Id: I40c2a64de05388918d35748ad99591f73000ca79
2021-06-16 10:45:41 +00:00
Yan Yan
b44d08eece Set up and tear down test network in TestNetworkRunnable am: 144ae3c76a
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14988700

Change-Id: I57411f845503f0f7d1bdc2800d16208ba6b46f2e
2021-06-16 10:45:39 +00:00
Lorenzo Colitti
3288cb52bc Correctly get uids for per-app network preferences am: 659a0e145f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14986139

Change-Id: I713bcdc3d0008074f8603263e415097322b26f4c
2021-06-16 04:07:10 +00:00
Lorenzo Colitti
74ded77039 Cleanup commit to remove @SkipPresubmit and fix nits
This commit removes @SkipPresubmit annotations in IpSecManagerTest to
re-enable Tcp6 tests in presubmit, since b/186608065 is fixed.

This commit also addresses nits in previous code reviews that include:
- Make EspAuthNull, EspAeadCipher, EspCryptCipher, EspCipherNull
  final classes
- Rename "INSTANCE" to "sInstance", "IPSEC_MANAGER" to "sIpSecManager"
- Rename protected field "iv" to "mIv"
- Use ArraySet instead of HashSet
- Remove unnecessary "public" and "final" in IpSecAlgorithmImplTest

Bug: 171083832
Test: atest IpSecAlgorithmImplTest
Original-Change: https://android-review.googlesource.com/1729418
Merged-In: Idde90ce5e4fc6f56ad617d5ba9735b1bcc2ce8cd
Change-Id: Idde90ce5e4fc6f56ad617d5ba9735b1bcc2ce8cd
2021-06-16 02:08:29 +00:00
Lorenzo Colitti
c1a70345b7 Verify kernel implementation of AES-CMAC
This CL adds a test to verify kernel implementation of AES-CMAC

Since there is no hardware that first launched with SDK beyond R
at the time of writing this CL, the test for AES-CMAC was manually
enabled and verified on redfin (redfin kernel already supports
AES-CMAC)

Bug: 171083832
Test: atest IpSecAlgorithmImplTest
Original-Change: https://android-review.googlesource.com/1697312
Merged-In: I8b7ee9272722aebdd84ca02475a6107ef61287a9
Change-Id: I8b7ee9272722aebdd84ca02475a6107ef61287a9
2021-06-16 02:07:50 +00:00
Lorenzo Colitti
69b777ccc8 Verify kernel implementation of AES-XCBC
This CL adds a test to verify kernel implementation of AES-XCBC.

Since there is no hardware that first launched with SDK beyond R
at the time of writing this CL, the test for AES-XCBC was manually
enabled and verified on coral (coral-kernel already supports
AES-XCBC)

Bug: 171083832
Test: atest IpSecAlgorithmImplTest
Original-Change: https://android-review.googlesource.com/1503696
Merged-In: I57e2bbed2954e4c7de906caae20390f7aebac0e3
Change-Id: I57e2bbed2954e4c7de906caae20390f7aebac0e3
2021-06-16 02:06:59 +00:00
Lorenzo Colitti
816c800df3 Verify kernel implementation of AES-CTR
This CL adds a test to verify kernel implementation of AES-CTR

Since there is no hardware that first launched with SDK beyond R
at the time of writing this CL, new tests for AES-CTR were manually
enabled and verified on coral (coral-kernel already supports
AES-CTR)

Bug: 171083832
Test: atest IpSecAlgorithmImplTest
Original-Change: https://android-review.googlesource.com/1503695
Merged-In: Ib626a6c3999b7d682d0858e92d0dbb5138fdc45d
Change-Id: Ib626a6c3999b7d682d0858e92d0dbb5138fdc45d
2021-06-16 02:06:11 +00:00
Lorenzo Colitti
09527d67ca Verify kernel implementation of ChaCha20Poly1305
This CL adds the test infra for testing kernel implementation of IPsec
algorithms and a test for ChaCha20Poly1305

Since there is no hardware that first launched with SDK beyond R at the
time of writing this CL, the test for ChaChaPoly was manually
enabled and verified on the pixel with an updated kernel

Bug: 171083832
Test: atest IpSecAlgorithmImplTest
Original-Change: https://android-review.googlesource.com/1503694
Merged-In: Ia29540c7fd6848a89bfa2d25c6a87921e45d98da
Change-Id: Ia29540c7fd6848a89bfa2d25c6a87921e45d98da
2021-06-16 02:05:07 +00:00
Lorenzo Colitti
2e65e9fa88 Support algorithm configurability in PacketUtils EspHeader
This CL adds support to configure the IPsec algortihms to build
EspHeader.

This is a prepration CL to test kernel implementation of IPsec
algorithms.

Bug: 171083832
Test: atest CtsNetTestCases
Original-Change: https://android-review.googlesource.com/1503693
Merged-In: I53f59815d6cb879dae622fcbd17616564a97111a
Change-Id: I53f59815d6cb879dae622fcbd17616564a97111a
2021-06-16 01:58:27 +00:00
Yan Yan
144ae3c76a Set up and tear down test network in TestNetworkRunnable
Allow test caller to construct a TestNetworkRunnable to run a
test with a test network.

This is a preparation for adding tests to verify kernel
implementation of IPsec algorithms.

Bug: 171083832
Test: atest Ikev2VpnTest
Original-Change: https://android-review.googlesource.com/1503692
Merged-In: I0e08a6ea299e6ad94d69806a2d76fa155653b62a
Change-Id: I0e08a6ea299e6ad94d69806a2d76fa155653b62a
2021-06-16 01:48:51 +00:00
Lorenzo Colitti
659a0e145f Correctly get uids for per-app network preferences
Per-app network functionality assumed all apps were installed for user 0
which is not always the case. This fix will address that by checking for
the existance of an app for all users and adding it to the per-app
network preference as was originally intended. Prior, no apps were
included if they were not installed for user 0 even if they were
available for another user such as user 10 in automotive.

Bug: 189838408
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCases

Original-Change: https://android-review.googlesource.com/1723617
Merged-In: I7d75cdb02041e7a202254be2eaeca6c2b02d7c29
Change-Id: I7d75cdb02041e7a202254be2eaeca6c2b02d7c29
2021-06-15 21:56:13 +00:00
Lorenzo Colitti
e5f9800e0b Don't run testGetAllNetworkStateSnapshots in instant app mode am: 1ee5ba31a6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14935371

Change-Id: I78224ae28eba3a4822d584c49d29085275f6cd77
2021-06-15 16:37:30 +00:00
Lorenzo Colitti
1ee5ba31a6 Don't run testGetAllNetworkStateSnapshots in instant app mode
Instant app mode doesn't have permission to request networks.
Thus, ignore the test in instant app mode.

Bug: 189724761
Test: CtsNetTestCases:ConnectivityManagerTest#testGetAllNetworkStateSnapshots \
      --instant
Original-Change: https://android-review.googlesource.com/1737396
Merged-In: I2897462f4ef6c019b80a3b5159b1c41f397af8de
Change-Id: I2897462f4ef6c019b80a3b5159b1c41f397af8de
2021-06-15 14:06:26 +00:00
Lorenzo Colitti
0bb712f93c Merge changes I3fffbf4a,If557b0a1 into sc-dev am: bba6383a73
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14963613

Change-Id: Iefc6f6ead2b61e2c36dea1c2a9077990b1d4980b
2021-06-15 11:28:07 +00:00
Treehugger Robot
b92c99534a Dump underlying BPF traffic stats as well as higher-level stats. am: 898d5adb31
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14963612

Change-Id: Idbc82073afde61e7f3706b7d975063a9fa1b25fd
2021-06-15 11:28:05 +00:00
Lorenzo Colitti
bba6383a73 Merge changes I3fffbf4a,If557b0a1 into sc-dev
* changes:
  Improve dumping IPv4 map entries.
  Dump underlying BPF traffic stats as well as higher-level stats.
2021-06-15 10:24:41 +00:00
TreeHugger Robot
8448b67a15 Merge "Add unit test when querying TYPE_WIFI + null/empty/non-null subscriberId" into sc-dev am: 97e90536a8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14963611

Change-Id: I1e444f94cff2cb0ce4041224a70b00997e24cdd4
2021-06-15 09:33:18 +00:00
TreeHugger Robot
97e90536a8 Merge "Add unit test when querying TYPE_WIFI + null/empty/non-null subscriberId" into sc-dev 2021-06-15 09:16:57 +00:00
Nucca Chen
4425a6147c Improve dumping IPv4 map entries.
1. Dump both upstream and downstream rules.
2. Also dump rule last used time.

Test: manual
Bug: 190783768
Original-Change: https://android-review.googlesource.com/1737394
Merged-In: I3fffbf4a5dea68e61349de8b41bea49b8a319f86
Change-Id: I3fffbf4a5dea68e61349de8b41bea49b8a319f86
2021-06-15 08:20:31 +00:00
Treehugger Robot
898d5adb31 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
Original-Change: https://android-review.googlesource.com/1737393
Merged-In: If557b0a18fc0aea1bf6a65d91547fc1930098ed0
Change-Id: If557b0a18fc0aea1bf6a65d91547fc1930098ed0
2021-06-15 08:19:51 +00:00
Les Lee
caa6f1793d Add unit test when querying TYPE_WIFI + null/empty/non-null subscriberId
Starting with API level 31, the subscriberId is applicable
for the wifi network. Considering applications may use
null or an empty string as subscriberId (for instance, cts),
frameworks create MATCH_WIFI_WILDCARD NetworkTemplate when querying
wifi network with null or an empty string which is the behavior before
API level 31.

Bug: 188915450
Test: atest -c NetworkStatsManagerTest
Merged-In: Id4ae06840e1749997e970b8f1ec391060967bd47
Change-Id: Id4ae06840e1749997e970b8f1ec391060967bd47
2021-06-15 14:53:25 +08:00
Luke Huang
7e773cd7b7 Merge "Modify NsdServiceTest to conform to its new mechanism" into sc-dev am: fcc69726ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14963260

Change-Id: I93de1a01024f6bddcb8575c1b9038d901acfe3c7
2021-06-15 04:59:00 +00:00
Luke Huang
fcc69726ed Merge "Modify NsdServiceTest to conform to its new mechanism" into sc-dev 2021-06-15 04:52:43 +00:00
Cody Kesting
7ca2e36684 Keep subIds for Test NetworkCapabilities. am: f5a4fb124b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14969444

Change-Id: I8d36d0bf7cbf229710d1c5d69e54b737f3919ec0
2021-06-15 04:50:07 +00:00
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
Cody Kesting
f5a4fb124b Keep subIds for Test NetworkCapabilities.
This CL updates NetworkCapabilities to retain configured subscription
IDs for Test NetworkCapabilities. Previously, they were cleared in
restrictCapabilitiesForTestNetwork().

Bug: 182291467
Bug: 189125789
Test: atest Ikev2VpnTest IpSecManagerTunnelTest
Test: atest CtsVcnTestCases
Change-Id: I0e1bc617910c9e8ac7b431572f276b1611acc1cb
Merged-In: I0e1bc617910c9e8ac7b431572f276b1611acc1cb
(cherry picked from commit a262a9d3d5)
2021-06-14 20:51:28 +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
Luke Huang
a46c4d2726 Modify NsdServiceTest to conform to its new mechanism
Adapt NsdServiceTest to its new mechanism for starting/stopping daemons.
Also, add a new test for the new self-cleanup mechanism.

Bug: 181810560
Test: atest NsdServiceTest
Original-Change: https://android-review.googlesource.com/1719018
Merged-In: I4c485a5d8fb4d6f52d82633a579bce4feb5c6375
Change-Id: I4c485a5d8fb4d6f52d82633a579bce4feb5c6375
2021-06-14 06:53:51 +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