Commit Graph

8618 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
bdbe7b72fe Merge "Send full LinkProperties to NetworkMonitor" 2020-05-12 08:13:05 +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
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
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
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
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
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
Chiachang Wang
098a24b8d4 Merge changes I3525edc3,I6e18915e am: 7752ddf0b7
Change-Id: Ie298cd37fdaa8d638298e8326c6f1db7a5d5b7b4
2020-04-29 09:08:45 +00:00
Chiachang Wang
7752ddf0b7 Merge changes I3525edc3,I6e18915e
* changes:
  Filter debug entries for each vpn
  Add test prefix into test cases
2020-04-29 08:43:02 +00:00
Chiachang Wang
1d5c290e38 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
2020-04-29 15:07:45 +08:00
Chiachang Wang
88fa813bd7 Add test prefix into test cases
Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
Change-Id: I6e18915e383ac20072cb238d0136d7a8e4ceb811
2020-04-29 13:44:50 +08:00
Benedict Wong
a7c8c64284 Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" am: eb8393aa09
Change-Id: Ib3e7bea4ad17eaf0b64bc157ed682c672a17f79a
2020-04-28 17:59:07 +00:00
Benedict Wong
eb8393aa09 Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" 2020-04-28 17:33:46 +00:00
Remi NGUYEN VAN
a065d07edf Use the new NetworkStackConnector constructor
The constructor was changed to allow for unit tests.

Bug: 137328719
Test: atest FrameworksNetIntegrationTests
Change-Id: I46f247268310e12d420531745a22e93cf3550e89
2020-04-28 15:50:38 +09:00
Cody Kesting
f53a075913 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
2020-04-27 20:55:00 -07:00
Cody Kesting
fc7cad313d 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
2020-04-27 20:54:57 -07:00
Remi NGUYEN VAN
c7276dea28 Merge "Add comment / logging in NetworkMonitor callbacks" am: 34e9cb2fdc
Change-Id: I8ba92e70462735961ae260234fc53f39e71994c5
2020-04-27 07:56:55 +00:00
Remi NGUYEN VAN
34e9cb2fdc Merge "Add comment / logging in NetworkMonitor callbacks" 2020-04-27 07:26:25 +00:00
Benedict Wong
aed6b6ff17 Merge "Add tests for Tunnel, Transport mode application with released SPIs" am: 27a2f1dff8
Change-Id: I60b9f6f52ba6aa64e6329f15ef1529b52c8a1b6a
2020-04-24 23:12:31 +00:00
Benedict Wong
fc7ba96b15 Merge "Use TransformRecord to get SPI instead of SpiRecord" am: 88c8a19311
Change-Id: If9d23537009ea1359d7dc198ba4662c85f8f4b0c
2020-04-24 23:12:27 +00:00
Benedict Wong
27a2f1dff8 Merge "Add tests for Tunnel, Transport mode application with released SPIs" 2020-04-24 22:32:41 +00:00
Benedict Wong
88c8a19311 Merge "Use TransformRecord to get SPI instead of SpiRecord" 2020-04-24 22:32:41 +00:00
Remi NGUYEN VAN
e468a26c7a Merge "Address comments on NetworkStack AIDL v6" am: 0e93810453
Change-Id: I755d14877a65b359c0837cab1488875d7238440e
2020-04-24 12:04:38 +00:00
Remi NGUYEN VAN
455b93d137 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
Change-Id: I2dbfc9bf7b2f785ea4594851bd354e9fd0fc0bd1
2020-04-24 20:56:39 +09:00
Remi NGUYEN VAN
0e93810453 Merge "Address comments on NetworkStack AIDL v6" 2020-04-24 11:56:32 +00:00
Remi NGUYEN VAN
9b647ca69a 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
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-24 18:52:02 +09:00
Treehugger Robot
1a01782799 Merge "Add test for NetworkSpecifier" am: 93c21fc7b5
Change-Id: I04cc2a0aad319e4266253267cacaecb517ec6efc
2020-04-23 14:31:52 +00:00
Treehugger Robot
93c21fc7b5 Merge "Add test for NetworkSpecifier" 2020-04-23 14:12:37 +00:00
Chiachang Wang
de4a675836 Add test for NetworkSpecifier
Tests for canBeSatisfiedBy() and redact()

Bug: 154686765
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkSpecifierTest
Change-Id: Iade6a5b355b8812a5eb191345dfe393938ee272c
2020-04-23 18:03:16 +08:00
Philip P. Moltmann
7b3866f284 Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" am: da8697a48b
Change-Id: I3ddd8954cf8443f549f7965cc43f2600bf92a80b
2020-04-22 15:09:28 +00:00
Philip P. Moltmann
7bc33dfb89 Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495
2020-04-20 18:00:03 -07:00
Lorenzo Colitti
d0359ea573 Merge "Stop prefix discovery if an RA prefix arrives in DISCOVERING" am: c44ca579ad
Change-Id: Ia51addeb9d1f954a396764ec049213ac216b7c1f
2020-04-20 11:21:47 +00:00
Lorenzo Colitti
3da6384b41 Merge "Make the Nat464Xlat tests more realistic." am: 6ce7a2aeee
Change-Id: I6a611b7fd7199d8c91baca39e04749ad8852a42e
2020-04-20 11:21:17 +00:00
Lorenzo Colitti
a00f03dd61 Merge "Support learning the NAT64 prefix from two different sources." am: 204b31920f
Change-Id: I8778773dab5f46aec6bf18c83d9766687307ca25
2020-04-20 11:20:58 +00:00
Lorenzo Colitti
c44ca579ad Merge "Stop prefix discovery if an RA prefix arrives in DISCOVERING" 2020-04-20 11:10:31 +00:00
Lorenzo Colitti
6ce7a2aeee Merge "Make the Nat464Xlat tests more realistic." 2020-04-20 11:06:08 +00:00
Lorenzo Colitti
204b31920f Merge "Support learning the NAT64 prefix from two different sources." 2020-04-20 11:05:52 +00:00
Lorenzo Colitti
38c6519a90 Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix
discovery is running, clatd will be correctly started, but
prefix discovery will be stopped.

In order to fix this, make it possible to call
stopPrefixDiscovery without transitioning to IDLE state (which
is obviously necessary in this case), by moving the assignment of
the next state from that method to its callers. For consistency,
do the same for startPrefixDiscovery.

Bug: 150648313
Test: new test coverage
Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
c6bd5847c9 Make the Nat464Xlat tests more realistic.
464xlat will never be started on a network that is not connected,
or on a network that has no IPv6 address.

This is a no-op test-only change but it is necessary for an
upcoming change that violates some of the invalid assumptions
currently made by this test and causes it to fail.

Bug: 150648313
Test: test-only change
Change-Id: I41766e9adaa7c24454648b371e6e3cc647693be5
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
e2eade021a Support learning the NAT64 prefix from two different sources.
The NAT64 prefix from the RA always takes precedence over the
NAT64 prefix from DNS discovery, because it is detected faster,
and detecting it does not require sending any packets.

Bug: 150648313
Test: new unit test
Change-Id: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902
2020-04-20 16:50:53 +09:00