Commit Graph

8887 Commits

Author SHA1 Message Date
Lorenzo Colitti
fdb0f113c7 Inform the DNS resolver when it needs to do DNS64 synthesis. am: 37aa693fb5
Change-Id: Ic418b02d68985a6a8ea22d845ad57349468b4dcd
2020-05-26 14:29:13 +00:00
Lorenzo Colitti
0d25cca3c9 Test that if an RA sets the same prefix as DNS, nothing happens. am: 0424f88915
Change-Id: I171ff7fd8140028dc4a4e7df5cc4663b8ad696e7
2020-05-26 12:58:22 +00:00
Lorenzo Colitti
37aa693fb5 Inform the DNS resolver when it needs to do DNS64 synthesis.
This is only necessary when learning the NAT64 prefix from the
RA, because if the NAT64 prefix is learned from DNS, the DNS
resolver already knows the prefix and automatically enables
DNS64 synthesis.

The DNS resolver needs to be informed of the prefix any time
clat is running on a prefix learned from an RA. This is simple to
implement: just set the prefix when starting clat if prefix
discovery is not running, and clear the prefix when stopping clat
if prefix discovery was not running. This ensures that the prefix
is cleared iff it was set.

Bug: 156914456
Test: new unit test coverage
Original-Change: https://android-review.googlesource.com/1315578
Merged-In: If8ad2d30712a6df3e207c8d3e8a129705242191e
Change-Id: If8ad2d30712a6df3e207c8d3e8a129705242191e
2020-05-26 11:52:35 +00:00
Lorenzo Colitti
0424f88915 Test that if an RA sets the same prefix as DNS, nothing happens.
This is not particularly likely to happen unless the pref64 RA is
sent by a different router than the main RA. But more tests are
always good, and this additional coverage will be more useful
in an upcoming change.

Bug: 150648313
Test: test-only change
Original-Change: https://android-review.googlesource.com/1316094
Merged-In: I3316d49d42100800740afadc4edf0a13a4d8377c
Change-Id: I3316d49d42100800740afadc4edf0a13a4d8377c
2020-05-26 11:35:33 +00:00
Cody Kesting
88d9f6bd64 Merge "Move Data Stall logic to CS from NetworkMonitorCallbacks." into rvc-dev am: 9b616b851f
Change-Id: I75c162680fa548da20a8ab3dcf664dd57feb9002
2020-05-21 16:04:19 +00:00
Cody Kesting
9b616b851f Merge "Move Data Stall logic to CS from NetworkMonitorCallbacks." into rvc-dev 2020-05-21 16:01:01 +00:00
Chalard Jean
4d320ee5eb Merge "Address nit from aosp/1301317" into rvc-dev am: 9024f27f97
Change-Id: I719006d1f3452a51303999dad5805ae0271ffddf
2020-05-21 07:04:43 +00:00
Chalard Jean
6b0c759287 Merge "Fix a bug where VPNs start out suspended on cellular" into rvc-dev am: 5c721ed487
Change-Id: If3e0353505e89ffb4b6ae2fe49e11639f20e293e
2020-05-21 07:03:51 +00:00
Chalard Jean
eaf94d5d0e Merge "Fix a bug where a spurious capabilities callback is sent." into rvc-dev am: acdacbfe65
Change-Id: I47f8f49d7e51ebaec68e7ad678f55fd0087847c7
2020-05-21 07:02:49 +00:00
Chalard Jean
9024f27f97 Merge "Address nit from aosp/1301317" into rvc-dev 2020-05-21 06:44:30 +00:00
Chalard Jean
5c721ed487 Merge "Fix a bug where VPNs start out suspended on cellular" into rvc-dev 2020-05-21 06:43:56 +00:00
Treehugger Robot
4a7eb2a5d2 Address nit from aosp/1301317
Test: atest ConnectivityServiceTest#testVpnSetUnderlyingNetworks
Bug: 150570873
Original-Change: https://android-review.googlesource.com/1307374
Merged-In: If5e5439b22f05e08a293fd83da4d54f6a4363ca5
Change-Id: If5e5439b22f05e08a293fd83da4d54f6a4363ca5
2020-05-21 05:12:41 +00:00
Chalard Jean
ebbece8b22 Fix a bug where VPNs start out suspended on cellular
As NetworkAgent is in a transition where all agents need
to include the NOT_SUSPENDED capability as part of their
migration to the system API, ConnectivityService adds it
forcefully to all agents that don't have the CELLULAR
transport. This doesn't include VPNs when VPNs have some
cellular network as their underlying network.

The best way to solve this is to make sure the VPN
capabilities reflect those of the underlying networks as
far as the NOT_SUSPENDED capability is concerned. This
is how they work for other similar capabilities.

This also happens to contain a drive-by fix for an issue
with a spurious capabilities callback is triggered when
a VPN connects and it has any underlying network (which
means almost always, because it will take the default
network if it doesn't declare any). Fixing this was
necessary to have a cogent test of this issue, but it
could be moved to another patch or it could stay unfixed
with some minor ajustment to the tests if judged too
dangerous to include in R at this point.

Test: New tests in this patch. Also manually tested with
      tcpdump as described in b/150570873.
Bug: 150570873
Original-Change: https://android-review.googlesource.com/1301317
Merged-In: I3e4ff990c0d4825b21c7679be29a482a2d1324ec
Change-Id: I3e4ff990c0d4825b21c7679be29a482a2d1324ec
2020-05-21 05:10:37 +00:00
Chalard Jean
bee5b3f227 Fix a bug where a spurious capabilities callback is sent.
When a VPN connects and it has any underlying network (which
means almost always, because it will take the default network
if it doesn't declare any), it has default capabilities and
will only take the capabilities of its underlying network
as part of an update happening after making the network
available but before the rematch can take place. This in turn
causes the capabilities callback sent as part of the rematch
to be spuriously sent.

Test: FrameworksNetTests. Also tested together with a
      followup that adds tests with drive-by coverage for this.
Bug: 150570873
Original-Change: https://android-review.googlesource.com/1305393
Merged-In: Id7d8bba486bada1a7ba5b0f152d2aa02e407f249
Change-Id: Id7d8bba486bada1a7ba5b0f152d2aa02e407f249
2020-05-21 05:09:15 +00:00
Cody Kesting
15eb17c2fc Move Data Stall logic to CS from NetworkMonitorCallbacks.
This change moves the logic for handling Data Stall notifications from
NetworkMonitorCallbacks to ConnectivityService. This avoids duplicate
logic for managing data stall simulation requests from
ConnectivityManager. This also puts all of the logic for proxying Data
Stall notifications to the ConnectivityDiagnosticsHandler into one
place.

Bug: 148032944
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Ie2f6a1a2376c5c452750ab417cb5e8c24fc44fc3
Merged-In: Ie2f6a1a2376c5c452750ab417cb5e8c24fc44fc3
(cherry picked from commit 745eaa39a3c9bcaaa61671f66d8c1180195c84c4)
2020-05-18 21:12:33 +00:00
Cody Kesting
afa449c852 Merge "Create TestApi for simulating a Data Stall on ConnectivityService." into rvc-dev am: 8ed33c51f1
Change-Id: I126dd23216a3a42a9745a2c97e26ac2599e307e1
2020-05-14 19:19:13 +00:00
Cody Kesting
2b628e49d4 Merge "Set owner and administrator UIDs for test networks." into rvc-dev am: 05d04fe553
Change-Id: Ia17090a6a00b878235d512a80e59d9f58fd1cbd9
2020-05-14 19:18:26 +00:00
Cody Kesting
8ed33c51f1 Merge "Create TestApi for simulating a Data Stall on ConnectivityService." into rvc-dev 2020-05-14 18:56:36 +00:00
Cody Kesting
05d04fe553 Merge "Set owner and administrator UIDs for test networks." into rvc-dev 2020-05-14 18:56:16 +00:00
Remi NGUYEN VAN
778914e606 Merge "Use the new NetworkStackConnector constructor" into rvc-dev am: 2404bc617a
Change-Id: Icf470e9e5f308a6575c98ad2f9f4a867c3e32e1e
2020-05-14 00:12:22 +00:00
Remi NGUYEN VAN
05c7af6c7c Use the new NetworkStackConnector constructor
The constructor was changed to allow for unit tests.

Bug: 137328719
Test: atest FrameworksNetIntegrationTests
Original-Change: https://android-review.googlesource.com/1295360
Merged-In: I46f247268310e12d420531745a22e93cf3550e89
Change-Id: I46f247268310e12d420531745a22e93cf3550e89
2020-05-13 09:18:52 +00:00
Remi NGUYEN VAN
36951833e2 Merge "Send full LinkProperties to NetworkMonitor" into rvc-dev am: d9e1872964
Change-Id: I2ec432881b77f0b093fc4ced18fe775a91ae93d3
2020-05-13 00:48:30 +00:00
Remi NGUYEN VAN
d9e1872964 Merge "Send full LinkProperties to NetworkMonitor" into rvc-dev 2020-05-13 00:34:41 +00:00
TreeHugger Robot
497e8f14fa Merge changes I37dd459d,I1959f308 into rvc-dev am: 0cd6d1cb70
Change-Id: Ie0c5a3c7bfc16edf98203212b8a1e7e4e8b302b9
2020-05-12 20:45:01 +00:00
Benedict Wong
4775132aa1 Use TransformRecord to get SPI instead of SpiRecord am: 2d70990d2c
Change-Id: I011543293623240b5652ac9818b0b3f28a397e97
2020-05-12 20:44:59 +00:00
Automerger Merge Worker
9ddf8a5953 Create TestApi for simulating a Data Stall on ConnectivityService.
This change adds a TestApi for simulating a Data Stall to
ConnectivityService. This allows for Data Stalls to be triggered without
having to manipulate the signals used by NetworkMonitor . This also
allows NetworkMonitor to update the ways it detects Data Stalls without
affecting CTS tests for ConnectivityDiagnosticsManager.

Bug: 148032944
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Icad439efa2ab4c872c21d3ee6ceaae8c5b49f18d
Merged-In: Icad439efa2ab4c872c21d3ee6ceaae8c5b49f18d
(cherry picked from commit b06463a002eb6215e9dda64e599eabd74cb56382)
2020-05-12 20:34:50 +00:00
Cody Kesting
a9b761d261 Set owner and administrator UIDs for test networks.
This change sets the owner and administrator UIDs for test networks when
their initial values match the UID for the app creating the test
network. This ensures that apps registering test networks can only make
themselves owners / administrators of the network.

Bug: 153449964
Test: atest NetworkAgentTest
Change-Id: I3a974700aa1d83cb285295ed1de0aa263e2e5b58
Merged-In: I3a974700aa1d83cb285295ed1de0aa263e2e5b58
(cherry picked from commit 35782280a2adceec96b8e03c217788afa05894a0)
2020-05-12 20:33:42 +00:00
Remi NGUYEN VAN
2c4a47d65c Send full LinkProperties to NetworkMonitor
Set the parcelSensitiveFields bit when sending LinkProperties to
NetworkMonitor, so that the captive portal API URL is not lost.

Test: atest ConnectivityServiceIntegrationTest (see followup change)
Bug: 156062304
Original-Change: https://android-review.googlesource.com/1307833
Merged-In: Ifd4e9c02a6b9a2b2b8b254fc4da7bfb9e0a84550
Change-Id: Ifd4e9c02a6b9a2b2b8b254fc4da7bfb9e0a84550
2020-05-12 09:14:38 +00:00
Benedict Wong
bfd3c75dce Add tests for Tunnel, Transport mode application with released SPIs
This change adds tests to validate that both transport and tunnel mode
transforms continue to work even after the SPI resource has been
released. Specifically, since SPI resources are effectively subsumed by
the creation of a Transform, the SPI resource is still "alive", but
removed from the user-tracking sparse arrays.

Bug: 142072071
Test: Added these new tests. Failing prior to aosp/1133555, passes with.
Change-Id: I37dd459d08b57b14f72f3b28ea80fa231b152f10
Merged-In: I37dd459d08b57b14f72f3b28ea80fa231b152f10
(cherry picked from commit 4d3f871a944d24cd7cbe3aa51a789a71020eafb5)
2020-05-08 00:01:59 -07:00
Benedict Wong
2d70990d2c Use TransformRecord to get SPI instead of SpiRecord
IpSecService.applyTunnelModeTransform() currently does not take an
SpiRecord instance, yet implicitly requires that the SpiRecord instance
is still alive based on the stored SpiRecord resourceId in
the TransformRecord's IpSecConfig.

This check is unnecessary, as the SpiRecord has been subsumed into the
TransformRecord, and the kernel resources are kept alive whether or
not the SpiRecord is still held by the user.

This allows users of the IpSecManager API to allocate short-lived SPIs
during the creation of an IpSecTransform, without having to keep track
of both of them (even though the SPI is no longer usable).

The TransformRecord.getSpiRecord() call is already used in
multiple other places in the same method.

Bug: 142072071
Test: New tests added, passing.
Change-Id: I1959f3080946267243564459ff4207647922566e
Merged-In: I1959f3080946267243564459ff4207647922566e
(cherry picked from commit 5258b1b82f39bf17e0751bcb94479464250aaec5)
2020-05-08 00:01:45 -07:00
Remi NGUYEN VAN
1f6d977758 Merge "Add comment / logging in NetworkMonitor callbacks" into rvc-dev am: a294a88751
Change-Id: I57d8597082c7cf72494e5d16bb0ff7cbc83fba37
2020-05-01 00:51:42 +00:00
Remi NGUYEN VAN
a294a88751 Merge "Add comment / logging in NetworkMonitor callbacks" into rvc-dev 2020-05-01 00:32:07 +00:00
Rambo Wang
d1aff7bde8 Merge "Restrict match conditions of TelephonyNetworkSpecifier#canBeSatisfied" into rvc-dev am: c19bf4fb3f
Change-Id: If7fb76656075d1b54320902b69882a8fd64bfc12
2020-04-30 22:39:37 +00:00
Rambo Wang
c19bf4fb3f Merge "Restrict match conditions of TelephonyNetworkSpecifier#canBeSatisfied" into rvc-dev 2020-04-30 22:23:13 +00:00
Benedict Wong
1d3126b526 Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" into rvc-dev am: 89ff63b804
Change-Id: I5c53eb9dcfc7d858e40f68cf20ddb684980ebaef
2020-04-30 17:40:55 +00:00
Benedict Wong
89ff63b804 Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" into rvc-dev 2020-04-30 17:29:29 +00:00
Remi NGUYEN VAN
4193f33575 Merge "Address comments on NetworkStack AIDL v6" into rvc-dev am: cc9f73cad3
Change-Id: I58b6863e5f8417368c7cd83edc487404d5156e99
2020-04-30 06:19:07 +00:00
Remi NGUYEN VAN
3d3c9f7b76 Add comment / logging in NetworkMonitor callbacks
Add a comment explaining the ordering of messages sent to the tracker
and connectivity diagnostics handlers.

Add a Slog.wtf call in case the deprecated notifyNetworkTested callback
is called.

Bug: 153500847
Test: atest ConnectivityServiceTest
Merged-In: I2dbfc9bf7b2f785ea4594851bd354e9fd0fc0bd1
Change-Id: I2dbfc9bf7b2f785ea4594851bd354e9fd0fc0bd1
2020-04-30 06:12:18 +00:00
Benedict Wong
0fff1ed7b9 Add filtering for IPsec algorithms in IKEv2 VPNs
This commit adds support for validating and filtering IPsec algorithms.
Without a public API exposing IKEv2 algorithms (and their respective
public APIs), the allowedAlgorithms can only filter the proposals for
IPsec (Child) SA algorithms.

Additionally, this removes the HMAC_SHA1 from the IKE SA's integrity
algorithm proposals due to insecurity

Bug: 153701879
Test: FrameworksNetTests passing, new tests added
Change-Id: I7e61a1612692db275b751330af5bacbf86836a8c
Merged-In: I7e61a1612692db275b751330af5bacbf86836a8c
(cherry picked from commit 94e1c08a9ad4b0ff17e0f3a77fff0d3364040ba5)
2020-04-29 23:05:35 -07:00
Remi NGUYEN VAN
cc9f73cad3 Merge "Address comments on NetworkStack AIDL v6" into rvc-dev 2020-04-30 06:02:32 +00:00
TreeHugger Robot
dc73da17af Merge "Filter debug entries for each vpn" into rvc-dev am: 1913e1d29b
Change-Id: I0b1a9b7ffc65bfa6c784ec215e64371ab8d14e93
2020-04-30 04:20:40 +00:00
TreeHugger Robot
be93c81ba8 Merge "Add test prefix into test cases" into rvc-dev am: 2fe712700e
Change-Id: I613235e39111132b5627c5d72c2b2f589d5c9641
2020-04-30 03:35:14 +00:00
Chiachang Wang
bd16241678 Filter debug entries for each vpn
NetworkStats calculation needs to filter out debug entries to
prevent over counting. While NetworkStatsFactory migrates data
usage over a VPN to the TUN network, NetworkStatsFactory does
not filter out debug entries per vpn which will cause debug
entries left and cause exception.

Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
      and verify no exception
Change-Id: I3525edc385b07858b48c7add2d331c4b5a2e84ad
Merged-In: I3525edc385b07858b48c7add2d331c4b5a2e84ad
2020-04-30 02:39:15 +00:00
Chiachang Wang
3cb1e03082 Add test prefix into test cases
Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
Change-Id: I6e18915e383ac20072cb238d0136d7a8e4ceb811
Merged-In: I6e18915e383ac20072cb238d0136d7a8e4ceb811
2020-04-30 02:38:18 +00:00
Remi NGUYEN VAN
f577197908 Address comments on NetworkStack AIDL v6
Address issues found during AIDL review:
 - Rename clientAddr to singleClientAddr
 - Do not use a ParcelableBundle for notifyNetworkTested or
   notifyDataStallSuspected; instead use AIDL parcelables for stronger
   backwards compatibility guarantees.

Test: atest NetworkMonitorTest ConnectivityServiceTest
      ConnectivityServiceIntegrationTest, manual
Bug: 153500847
Merged-In: Id9b71784e5f6294d203230e57737979e063ff0f8
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-28 08:09:17 +00:00
Rambo Wang
3745c39f98 Restrict match conditions of TelephonyNetworkSpecifier#canBeSatisfied
TelephonyNetworkSpecifier will now treat null as matching nothing. When
the request specifies a TelephonyNetworkSpecifier while the network does
not, this should not be treated as a match.

Bug: 154703135
Test: atest android.net.TelephonyNetworkSpecifierTest
Change-Id: I329110e929995c9eae6c6ce33b5414777acea1e1
2020-04-27 14:25:39 -07:00
TreeHugger Robot
b09dd19436 Merge "Move DhcpInfoTest to frameworks/base/tests/net/common" into rvc-dev am: 89930cbb29
Change-Id: I87c6ff9698d9f8fadea6139359f7479a72adc965
2020-04-24 06:27:51 +00:00
TreeHugger Robot
89930cbb29 Merge "Move DhcpInfoTest to frameworks/base/tests/net/common" into rvc-dev 2020-04-24 06:15:13 +00:00
TreeHugger Robot
5d74bf5bca Merge "Add test for NetworkSpecifier" into rvc-dev am: 326ac97692
Change-Id: I0e345d63b92fa83c4aa274481f9c669db24eb1f3
2020-04-24 01:34:51 +00:00
Treehugger Robot
22ef3a8747 Add test for NetworkSpecifier
Tests for canBeSatisfiedBy() and redact()

Bug: 154686765
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkSpecifierTest
Change-Id: Iade6a5b355b8812a5eb191345dfe393938ee272c
Merged-In: Iade6a5b355b8812a5eb191345dfe393938ee272c
(cherry picked from commit ae84f1ac325e54f021c720744c787b66525d12ea)
2020-04-24 00:09:55 +00:00