Commit Graph

721 Commits

Author SHA1 Message Date
junyulai
011b1f15c2 [KA02] internal cleanup and refactor for SocketKeepalive
In previous change, the new SocketKeepalive API was exported.
But internally, old PacketKeepalive names and structures are
still used.

This change rename them properly for code consistency and also
refactor KeepalivePacketData to support different types of
KeepalivePacketData.

Bug: 114151147
Test: 1. atest FrameworksNetTests
      2. atest FrameworksWifiTests
      3. atest FrameworksTelephonyTests

Change-Id: Ia9917d12987e91e87e34ffb3f126e7bc7c9c187e
Merged-In: Ia9917d12987e91e87e34ffb3f126e7bc7c9c187e
2019-02-05 20:13:47 +09:00
Varun Anand
35200a3b8a Merge "Add an API that allows VPNs to declare themselves as metered." 2019-01-31 02:43:25 +00:00
Varun Anand
83759ee94b Add an API that allows VPNs to declare themselves as metered.
For VPN apps targeting Q and above, they will by default be treated as
metered unless they override this setting before establishing VPN.

Bug: 120145746
Test: atest FrameworksNetTests
Test: On device tests verifying meteredness setup correctly for apps
targeting Q and apps targeting P.
Change-Id: Ia6d1f7ef244bc04ae2e28faa59625302b5994875
2019-01-30 14:09:03 -08:00
Remi NGUYEN VAN
6e82be4e4a Remove last NetworkStack usage of hidden APIs
Includes various small changes to stop using hidden APIs

Test: make NetworkStack
Test: flashed, booted, WiFi and tethering working
Bug: 112869080
Change-Id: Id2830795a444f484b377ed6437435a1cd833697a
2019-01-30 10:23:24 +09:00
Pavel Grafov
76e3e0052c Merge "Whitelist packages from VPN lockdown." 2019-01-28 20:15:49 +00:00
Remi NGUYEN VAN
8f8deae60f Merge "Move NetworkUtils used by NetworkStack" 2019-01-28 09:06:20 +00:00
Remi NGUYEN VAN
e167e117c1 Move NetworkUtils used by NetworkStack
Depending on usage move into NetworkStackUtils or shared
Inet4AddressUtils.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Merged-In: Ie20dcee375b377236004a7689890729493aca857
Change-Id: Ib8d000529872796022706a35050fdc2c7141f2ab
2019-01-28 13:45:17 +09:00
Remi NGUYEN VAN
8bd18cff9a Add NetworkStack networking deps to SystemApi
Cherry-pick with conflicts fixed in CaptivePortalLoginActivity imports.
Test: atest FrameworksNetTests
Bug: 112869080
Merged-In: Id59dc06fb85e4ac88098f56b621ec880610759ce
Change-Id: I3c05e8fdd70497426d4fa433295c4fbdad07d9c9
2019-01-28 13:28:35 +09:00
Pavel Grafov
3aeb3f3455 Whitelist packages from VPN lockdown.
Bug: 77468593
Test: atest com.android.server.connectivity.VpnTest
Change-Id: I9119c139ab07a761ce5dfd1365b70eb905fd32dc
2019-01-25 19:59:03 +00:00
Dan Albert
7e81ae73b4 Merge "Revert "Whitelist packages from VPN lockdown."" 2019-01-24 21:08:46 +00:00
Dan Albert
45f1a24661 Revert "Whitelist packages from VPN lockdown."
This reverts commit f1a610a1c2.

Reason for revert: broke pi-dev-plus-aosp

Change-Id: Iaf5c8aa4a8720eb2852da8cd91c81a77ccb92b68
2019-01-24 21:05:39 +00:00
Treehugger Robot
b11e29d4b3 Merge "Add API for proxy configuration over VPN." 2019-01-24 17:52:22 +00:00
Pavel Grafov
bec7854508 Merge "Whitelist packages from VPN lockdown." 2019-01-24 17:34:55 +00:00
Pavel Grafov
f1a610a1c2 Whitelist packages from VPN lockdown.
Bug: 77468593
Test: atest com.android.server.connectivity.VpnTest
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Test: MixedDeviceOwnerTest#testAlwaysOnVpnAcrossReboot
Change-Id: I7f6c5b9172063b588feacd6b9930a6cb88f764ab
Merged-In: I7f6c5b9172063b588feacd6b9930a6cb88f764ab
2019-01-24 16:17:11 +00:00
Irina Dumitrescu
de132bb6d6 Add API for proxy configuration over VPN.
Test: runtest -x
frameworks/base/tests/net/java/com/android/server/ConnectivityServiceTest.java
&& atest HostsideVpnTests
Bug: 76001058
Change-Id: Id4dde4a4103fd93bfbbacc52d0e5ade56ae67a6a
Merged-In: Id4dde4a4103fd93bfbbacc52d0e5ade56ae67a6a
2019-01-24 16:07:20 +00:00
Lucas Lin
01eeab4954 Merge "Popup a notification after logging in the captive portal network" 2019-01-24 11:06:12 +00:00
lucaslin
b1e8e385dd Popup a notification after logging in the captive portal network
Captive portal app will be auto dismissed after user login the
captive portal network. In order to improve the user experience,
popup a notification to notify user that the captive portal
network is connected.

Bug: 113629026
Test: 1.atest FrameworksNetTests:NetworkNotificationManagerTest
      2.Connect to a captive portal network and login, check if
      there is a notification popup.

Change-Id: Id54d12268e107af2f213c2bb348c5f7908e880f4
2019-01-24 15:55:30 +08:00
junyulai
d05a192fbe [KA05] Export keepalive offload api for IpSec Nat-T file descriptor
Adds system api of createSocketKeepalive to take file descriptor,
so privileged apps could use it without the need of IpSecService.

Bug: 114151147
Test: atest FrameworksNetTests
Change-Id: If926c21704b6ed73a0adfcadad732b97b42bacae
2019-01-24 00:40:25 +08:00
junyulai
4c95b08a23 [KA01] export SocketKeepalive API for NAT-T keepalive
The new set of API replace the PacketKeepalive system API
which is only specific for IPsec NAT-T keepalive packet. Allows
applications to request different types of keepalives through
the same set of API.

By using keepalives, applications could request system to
periodically send specific packets on their behalf, using
hardware offload to save battery power.

This change would only address interface change and test part of
original functionality. After all reference of PacketKeepalive
are removed, another change would be submitted to remove old
API.

Bug: 114151147
Test: atest FrameworksNetTests
Change-Id: I3367666810acc44d5ad20e19acd4bf936e8b5d9c
2019-01-23 23:17:17 +08:00
Lorenzo Colitti
bb5952107d Merge "Stop depending on the ConnectivityService default request." 2019-01-23 12:29:40 +00:00
Lorenzo Colitti
0d1aaee1dd Stop depending on the ConnectivityService default request.
This avoids the need to expose ConnectivityService implementation
details as @SystemApi and the complexities that would be required
to make NetworkCapabilities parcelable in stable AIDL.

Bug: 112869080
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Icd5d25b9b8e9b7a7d1899b000c92dc4976c3b3d7
2019-01-23 18:10:06 +09:00
Chalard Jean
2b428221cb Merge changes If71fadd2,I42047185
* changes:
  [MS10] Address leftover comments on MS03 and MS07
  [MS09] Implement isSameNetwork.
2019-01-22 22:50:21 +00:00
Pavel Grafov
5e135e2bdc Merge "Add API for VPN apps to query always-on and lockdown." 2019-01-22 14:43:06 +00:00
Chalard Jean
7f8be9f6ca [MS09] Implement isSameNetwork.
Test: Old tests pass, new tests pass too.
Bug: 113554482

Change-Id: I420471853f3fab7725cba7ae500cebdce1912e43
2019-01-22 19:10:48 +09:00
Remi NGUYEN VAN
bda2c4fe17 Merge "Add NetworkStack metrics to system API" 2019-01-22 07:48:39 +00:00
Lorenzo Colitti
4433025623 Properly expect all callbacks in testStackedLinkProperties.
Currently testStackedLinkProperties accounts for some of the
NetworkCallbacks that are fired, but not all of them. The test
passes because it only ever expects LinkProperties changed
callbacks (and not, e.g., lost callbacks), because it uses
waitForIdle(), and because at the end, when the callback is
unregistered, it does not call assertNoCallback().

Add the missing callback expectation and expect a LOST callback
at the end. Also add an assertNoCallback, even though it's not
strictly necessary. Remove all the waitForIdle statements, which
are no longer necessary because every assertion happens after
waiting for a callback.

Making the expectations more precise in a separate CL will help
ensure that upcoming changes to this code don't break anything,
and will make said changes easier to review.

Bug: 65674744
Test: atest FrameworksNetTests
Test: ConnectivityServiceTest#testStackedLinkProperties passes 400 times
Change-Id: I73cda0dd029a0e6546f7272beedf841ce5a4c0dc
2019-01-22 10:53:00 +09:00
Remi NGUYEN VAN
c8bf99d5d9 Add NetworkStack metrics to system API
Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: Ie52c55f248c173e2a5ee603ecd004fbac9004ac1
2019-01-21 23:24:41 +00:00
Pavel Grafov
e87b7ceaa6 Add API for VPN apps to query always-on and lockdown.
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Bug: 72628179
Change-Id: I73cb0888f7049b12ab0cdfa62678c3846e074d3b
2019-01-21 13:48:45 +00:00
Chalard Jean
b8997229ad [MS08] Read back attributes and blobs.
Test: New tests in IpMemoryStore
Bug: 113554482

Change-Id: I2ddfef0c2ed37459c038f75d1dfc92fdefbf58f5
2019-01-21 15:21:09 +09:00
Josh Gao
5ceb563f51 Merge "Avoid calling ParcelFileDescriptor.fromSocket on new Sockets." 2019-01-18 22:25:35 +00:00
Etan Cohen
107ae95001 [CS] Add an option to block sensitive network specifier
Network specifiers are used for 2 purposes:

- As part of network requests to specify more information on the type
  of requested networks.
- On network agents to specify information about their networks.

The network specifiers of the requests and agents are matched to each
other. However, the agent network specifier may contain sensitive
information which we do not want forwarded to any app.

This CL adds an option to strip out this agent network specifier before
the network capabilities are forwarded to the app.

Bug: 122160111
Test: atest ConnectivityServiceTest (frameworks/base/tests/net)
Test: atest frameworks/base/tests/net
Test: atest frameworks/opt/net/wifi/tests/wifitests
Test: atest frameworks/opt/telephony/tests/telephonytests
Test: atest frameworks/opt/net/ethernet/tests
Test: atest android.net.cts - some flakiness!
Test: act.py ThroughputTest
Test: act.py DataPathTest
Test: atest SingleDeviceTest (cts)
Change-Id: If08d312ff814bdde1147518f923199e6349503d5
2019-01-17 16:30:05 -08:00
Lorenzo Colitti
1d3bf3d90c Test parceling empty LinkProperties.
Test: atest FrameworksNetTests
Change-Id: Iec53a9fdce1ba1db86751ea5f14a11d28be543eb
2019-01-15 12:53:59 +09:00
Lorenzo Colitti
ae53ea1874 Delete the clatd functions from NetworkManagementService.
Make Nat464Xlat talk to netd directly instead of through
NetworkManagementService. The methods in NetworkmanagementService
don't really provide any value: since the only thing they do is
call into netd, we might as well have the callers talk to netd
directly,

In order to do this, pass INetworkManagementService and INetd to
the NetworkAgentInfo constructor, and update callers appropriately.

Bug: 65674744
Test: builds, boots
Test: atest FrameworksNetTests
Change-Id: Iac4cfe709c6279e4d9682b6754963e533707bd12
2019-01-15 11:13:07 +09:00
Lorenzo Colitti
981b34f6b8 Add the NAT64 prefix to LinkProperties.
Currently we support exactly one NAT64 prefix. This matches what
other components in the system (Dns64Configuration, clatd, etc.)
support.

Test: atest FrameworksNetTests
Change-Id: I45a11cebe43a5e1c60d50eca7889cb317565b598
2019-01-12 02:16:34 +09:00
Chalard Jean
6dd2486300 [MS02] Write the skeleton for the IP memory store.
This implements a minimal contract for the IP Memory Store
feature.

Test: Created new tests for parcelable code. For the rest, created
      empty tests, but there is no logic, it's boilerplate day
Bug: 116512211
Change-Id: I15dc6275b370d671385ddfdb058a8b8d39952d6e
2019-01-11 15:01:00 +09:00
Chalard Jean
d3829de504 [MS01] Add the IP memory store service.
Bug: 116512211
Test: Added initial tests
Change-Id: I9d9af4097e3e2d7afd9956b9cbfa29a9f9558ae0
2019-01-11 15:00:36 +09:00
Remi NGUYEN VAN
b35979db6b Merge "Move NetworkMonitor to NetworkStack" 2019-01-11 05:08:52 +00:00
Remi NGUYEN VAN
8539129ad9 Move NetworkMonitor to NetworkStack
Bug: b/112869080
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1b8b6a3f4390adbabf92fb9e48da61c47b08b2ec
2019-01-11 09:59:11 +09:00
Chalard Jean
a99e1eeb9d Merge "Add PCSCF to LinkProperties." 2019-01-10 05:55:05 +00:00
Junyu Lai
926c915708 Merge "Ignore ipv6 tx traffic on clat uid." 2019-01-04 09:29:10 +00:00
Etan Cohen
73fb5a86f0 [CM] Fix comments, add tests to TransportInfo API
Bug: 117605977
Test: atest NetworkCapabilitiesTest
Change-Id: I734ec56e44cd09d11ae81a856a53a26e1191b9a0
2018-12-11 15:00:10 -08:00
junyulai
879dbfa624 Ignore ipv6 tx traffic on clat uid.
Currently, 464xlat counts its ipv6 tx traffic into root uid.
When user is making ipv4 upload over ipv6-only network, ipv4
tx traffic may sometimes be counted faster then ipv6 tx
traffic.

Thus, NetworkStatsService may detect non-monotonic values due
to 464xlat adjustment.

So the solution is that: for clatd, make ipv6 tx traffic counts
into clat uid, and then ignore it in the framework side.

Bug: 118602783
Test: 1. manually verify clatd traffic on clat uid.
      2. runtest frameworks-net

Change-Id: Ifb478b79e3e281918c70e16d1f90682c78f33db1
2018-12-10 15:19:03 +08:00
Junyu Lai
12924cb23b Merge "Refactoring of deleting stats in NetworkStats based on uids." 2018-12-10 05:15:28 +00:00
Etan Cohen
0e18882d5c Merge "[CS] Add a generic transport-specific information API" 2018-12-09 03:53:44 +00:00
Etan Cohen
ac07cca084 [CS] Add a generic transport-specific information API
Add a generic transport-specific information container interface and
access methods. These can be used by a network factory to pass transport
(bearer)-specific network parameters to the app.

Bug: 117605977
Test: atest frameworks/base/tests/net/java/android/net (+new unit tests)
Change-Id: Ib7c83b677e1c02a2212265719813e648b0c9cc1b
2018-12-07 17:37:48 +00:00
Treehugger Robot
a3713ac30d Merge "Call netd to update the tcp buffer size" 2018-12-06 19:01:24 +00:00
junyulai
edb60c461b Refactoring of deleting stats in NetworkStats based on uids.
In follow-up commits, current API would create new NetworkStats
every time when 464xlatAdjustment wants to filtered out some
uids.

This commit refactors it to delete stats in-place to get better
performance.

Bug: 118602783
Test: atest FrameworksNetTests
Change-Id: I858f95d1fa7733111786243b4e261ce8a70a068d
2018-12-06 19:01:17 +09:00
Hongshik
e2d7cf5aed Add PCSCF to LinkProperties.
Some applications or services are needed PCSCF address to register IMS server but there is no way to get it on Android Framework.
We have added PCSCF address to LinkProperties like attached diff files.

Test: get Linkproperties and check Pcscf addresses.
      atest FrameworksNetTests

Change-Id: Ic2341a4ce2ed88d560325721766fc21f85f7ff86
Signed-off-by: Hongshik <hshik.kim@samsung.com>
2018-12-05 22:05:49 +09:00
Luke Huang
a904fab046 Use ParcelFileDescriptor instead of FileDescriptor in INetd.aidl
Stable aidl won't support FileDescriptor but ParcelFileDescriptor.
In order to migrate to stable aidl, replace all FileDescriptor in
INdetd.aidl.

Test: runtest frameworks-net passes
Change-Id: Icdf37aed0e0cce0352070a437066e77c0f2fd85a
2018-11-28 13:41:58 +08:00
Chenbo Feng
1541629a3f Call netd to update the tcp buffer size
The system server is controlling the tcp buffer now by writing to
/sys/kernel/ipv4/tcp_{rmem,wmem}_{min,def,max}. Those files are
basically the same as /proc/sys/net/ipv4/tcp_{rmem,wmem} except those
latter ones contain all three values in one file. Netd can directly write
to those files so we no longer need to depend on these android specific
files.

Test: netd_integration_test
Bug: 118572798
Change-Id: I588b48be29ecf61fd5bbf94f97f63738be4eae25
2018-11-27 15:37:52 -08:00