Commit Graph

9802 Commits

Author SHA1 Message Date
Benedict Wong
0d7bed76cb Add methods for IKEv2/IPsec test mode profiles
This change adds the ability for IKEv2/IPsec VPN profiles to run on Test
Networks. If enabled, the IKEv2/IPsec VPN profiles will request ONLY
test networks.

Bug: 148582947
Test: FrameworksNetTests passing
Test: Added for testing
Change-Id: I2511b39b27a1e29ae97907cdb12728d13fb1628f
2020-05-12 22:55:55 -07:00
Remi NGUYEN VAN
5460972621 [automerger skipped] Merge "Send full LinkProperties to NetworkMonitor" into rvc-dev am: d9e1872964 -s ours
am skip reason: Change-Id Ifd4e9c02a6b9a2b2b8b254fc4da7bfb9e0a84550 with SHA-1 c9f24746f2 is in history

Change-Id: Ic5d0d8461cbaf0a75da92b47d2d0aaa7a7743fb6
2020-05-13 00:48:39 +00:00
Remi NGUYEN VAN
d9e1872964 Merge "Send full LinkProperties to NetworkMonitor" into rvc-dev 2020-05-13 00:34:41 +00:00
Cody Kesting
f5cc4eae9e 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
2020-05-12 16:24:46 -07:00
TreeHugger Robot
6e6dad4cd1 [automerger skipped] Merge changes I37dd459d,I1959f308 into rvc-dev am: 0cd6d1cb70 -s ours
am skip reason: Change-Id I37dd459d08b57b14f72f3b28ea80fa231b152f10 with SHA-1 b645699cdb is in history

Change-Id: I0b5556bcaa27ca0a379f910bfba80aec506348c9
2020-05-12 20:41:03 +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
Cody Kesting
f42a04447b Merge "Create TestApi for simulating a Data Stall on ConnectivityService." am: e743a30aa7 am: b36fa34041
Change-Id: I17839cd271d984f76c203889293cc51375bb8bcb
2020-05-12 17:27:09 +00:00
Cody Kesting
801b5b9ea3 Merge "Set owner and administrator UIDs for test networks." am: 2ba1b8ecd1 am: f9877d902e
Change-Id: I7af702ff5eafbd0f5bb2247e0debf975e51accd1
2020-05-12 17:26:44 +00:00
Cody Kesting
b36fa34041 Merge "Create TestApi for simulating a Data Stall on ConnectivityService." am: e743a30aa7
Change-Id: Ie14ab9cbcf8f7b291fb88f4b4abedab1b5978c3e
2020-05-12 17:10:10 +00:00
Cody Kesting
f9877d902e Merge "Set owner and administrator UIDs for test networks." am: 2ba1b8ecd1
Change-Id: I3b1c29b30912c4dddc3524a9a28fb3ad8c3ac318
2020-05-12 17:09:14 +00:00
Cody Kesting
e743a30aa7 Merge "Create TestApi for simulating a Data Stall on ConnectivityService." 2020-05-12 16:52:35 +00:00
Cody Kesting
2ba1b8ecd1 Merge "Set owner and administrator UIDs for test networks." 2020-05-12 16:52:07 +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
Remi NGUYEN VAN
6744f95206 Merge "Send full LinkProperties to NetworkMonitor" am: bdbe7b72fe am: 167f06836c
Change-Id: I7e81f65e4b8f22a646dba191748133841a569d44
2020-05-12 08:53:53 +00:00
Remi NGUYEN VAN
167f06836c Merge "Send full LinkProperties to NetworkMonitor" am: bdbe7b72fe
Change-Id: Ib33f33a1998b61b980315e7278162e57f8f56cf2
2020-05-12 08:37:41 +00:00
Remi NGUYEN VAN
bdbe7b72fe Merge "Send full LinkProperties to NetworkMonitor" 2020-05-12 08:13:05 +00:00
Chalard Jean
9b010a98db Merge "Fix a bug where VPNs start out suspended on cellular" am: bd3a7f994d am: e428a22b07
Change-Id: I368308ded731b221be7fae6ddf1723c587ae4d20
2020-05-11 04:59:35 +00:00
Chalard Jean
e428a22b07 Merge "Fix a bug where VPNs start out suspended on cellular" am: bd3a7f994d
Change-Id: Ic28ed72f30d49da7bd137b4d4db125b895025ed0
2020-05-11 04:46:46 +00:00
Chalard Jean
4f8109f638 Address nit from aosp/1301317
Test: atest ConnectivityServiceTest#testVpnSetUnderlyingNetworks
Bug: 150570873
Change-Id: If5e5439b22f05e08a293fd83da4d54f6a4363ca5
2020-05-11 13:25:16 +09:00
Chalard Jean
fbd6a2c012 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
Change-Id: I3e4ff990c0d4825b21c7679be29a482a2d1324ec
2020-05-11 10:44:50 +09:00
Remi NGUYEN VAN
c9f24746f2 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
Change-Id: Ifd4e9c02a6b9a2b2b8b254fc4da7bfb9e0a84550
2020-05-10 16:11:11 +09: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
Chalard Jean
5cc55c46d0 Merge "Fix a bug where a spurious capabilities callback is sent." am: 0d4995dcb7 am: 4726fe863c
Change-Id: Ied089ed5ca553b206bdb3f7195f9e623aaabfa00
2020-05-08 01:33:13 +00:00
Chalard Jean
4726fe863c Merge "Fix a bug where a spurious capabilities callback is sent." am: 0d4995dcb7
Change-Id: Ide91b1e5ce2fe17dd6c6b46644e0d30b47660b2f
2020-05-08 01:14:37 +00:00
Chalard Jean
0d4995dcb7 Merge "Fix a bug where a spurious capabilities callback is sent." 2020-05-08 00:49:33 +00:00
Sarah Chin
2fcd85f62d [automerger skipped] Merge "Added a new capability for temporarily unmetered network." am: c5c7994da9 am: 5581c36ff3 -s ours
am skip reason: Change-Id I10e26cb0852e67f614e7b9c4e49f95e078602e21 with SHA-1 71863e9604 is in history

Change-Id: Ie43cc7dbddd5497dfa069fac5570a7a64eddb2a1
2020-05-07 06:12:02 +00:00
Sarah Chin
5581c36ff3 Merge "Added a new capability for temporarily unmetered network." am: c5c7994da9
Change-Id: I94eb37627875f96c7e70a5df9d273266bc4def66
2020-05-07 06:01:20 +00:00
Chalard Jean
d568791283 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
Change-Id: Id7d8bba486bada1a7ba5b0f152d2aa02e407f249
2020-05-07 12:07:03 +09:00
Jack Yu
0298306ba0 Added a new capability for temporarily unmetered network.
Added a new network capability TEMOPORARILY_NOT_METERED to support
the case that a network can temporarily become unmetered. This
allows carriers to deploy unmetered 5G network. When devices
camp on 5G network, this capability will be dynamically added
to the network and will be removed once leaving 5G coverage.

Bug: 153081494
Test: Manual
Change-Id: I10e26cb0852e67f614e7b9c4e49f95e078602e21
Merged-In: I10e26cb0852e67f614e7b9c4e49f95e078602e21
2020-05-06 13:13:45 -07:00
Treehugger Robot
75986b4623 [automerger skipped] Merge "[SM10] Adopt helper class to monitor RAT type change per sub" am: f4a8f1f21e am: 7e92e7330c -s ours
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 c6081f9c50 is in history

Change-Id: I44a2ee47f6a88286b28d5165c67cfd4fdbdd0152
2020-05-05 11:54:36 +00:00
Treehugger Robot
7e92e7330c Merge "[SM10] Adopt helper class to monitor RAT type change per sub" am: f4a8f1f21e
Change-Id: Ifadf4ad62820c6cbf536a3984b1cf4a0b78cbc31
2020-05-05 11:32:31 +00:00
junyulai
d33735c952 [SM10] Adopt helper class to monitor RAT type change per sub
Test: atest NetworkStatsServiceTest
Bug: 146415925
Change-Id: I45c3aa9046b316c8cd0943543d620a22e4afefd1
Merged-In: I45c3aa9046b316c8cd0943543d620a22e4afefd1
(cherry picked from commit 219faff07bdc58c14fe58fc525e86383db1f8167)
2020-05-05 18:37:29 +08:00
Remi NGUYEN VAN
d624b40eaf Merge "Use the new NetworkStackConnector constructor" am: 062e45d48c am: d04dcdcea0
Change-Id: I6bf23b1716706aaa757170ec3a60062ff4fcb1e0
2020-05-01 04:47:17 +00:00
Remi NGUYEN VAN
d04dcdcea0 Merge "Use the new NetworkStackConnector constructor" am: 062e45d48c
Change-Id: Ifaef8916460a4c3c275b9cdf20ee87b562a42785
2020-05-01 04:30:38 +00:00
Remi NGUYEN VAN
062e45d48c Merge "Use the new NetworkStackConnector constructor" 2020-05-01 04:19:29 +00:00
Remi NGUYEN VAN
416fe56663 [automerger skipped] Merge "Add comment / logging in NetworkMonitor callbacks" into rvc-dev am: a294a88751 -s ours
am skip reason: Change-Id I2dbfc9bf7b2f785ea4594851bd354e9fd0fc0bd1 with SHA-1 455b93d137 is in history

Change-Id: Ie0d51de52ed26f4eabc0c0f6e72e4ec455b6a039
2020-05-01 00:51:36 +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
a0cc785ec6 Merge "Restrict match conditions of TelephonyNetworkSpecifier#canBeSatisfied" into rvc-dev am: c19bf4fb3f
Change-Id: I84be6ef46eb2e99749a86f24304555bff51ebfe6
2020-04-30 22:40:29 +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
d5f65c02bc [automerger skipped] Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" into rvc-dev am: 89ff63b804 -s ours
am skip reason: Change-Id I7e61a1612692db275b751330af5bacbf86836a8c with SHA-1 8e3914c162 is in history

Change-Id: I91f2a1820666357bffc974b0eab4e156e5d011a5
2020-04-30 17:40:38 +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
Rambo Wang
dae8532479 Merge "Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier" am: bf1206f8fa am: c00993f9c8
Change-Id: I80164890061f1f3ba6900e6f5e73e3bc6fc04b5c
2020-04-30 15:31:31 +00:00
Rambo Wang
c00993f9c8 Merge "Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier" am: bf1206f8fa
Change-Id: Ia4f99dcf6c86a356c1490b6500dd5e5016ff7257
2020-04-30 15:19:24 +00:00
Rambo Wang
bf1206f8fa Merge "Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier" 2020-04-30 15:07:18 +00:00
Rambo Wang
f3508769ea Rename satisfiedBy to canBeSatisfiedBy for MatchAllNetworkSpecifier
MatchAllNetworkSpecifier is a subclass of NetworkSpecifer. The method
satisfiedBy should be renamed to canBeSatisfiedBy together with other
subclass of NetworkSpecifer in b/152238712.

Add annotation @Overide for the method to make sure it will not get
ignored when refactor in the future.

Bug: 154956584
Test: atest android.net.MatchAllNetworkSpecifierTest
Change-Id: Ibe32fd50fae43aa635c1c0dad66eaea82011c8b7
2020-04-30 15:06:35 +00:00
Remi NGUYEN VAN
4d1c237b8c [automerger skipped] Merge "Address comments on NetworkStack AIDL v6" into rvc-dev am: cc9f73cad3 -s ours
am skip reason: Change-Id Id9b71784e5f6294d203230e57737979e063ff0f8 with SHA-1 9b647ca69a is in history

Change-Id: I34895c81e5abfe3baf155582cf557ce909af5965
2020-04-30 06:18:35 +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