Commit graph android_packages_modules_Co.../tests/net/java
Message SHA1
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

Irina Dumitrescu   commited 2019-01-24 16:07:20 +00:00
de132bb6d6
Merge "Stop depending on the ConnectivityService default request."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2019-01-23 12:29:40 +00:00
bb5952107d
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

Lorenzo Colitti   commited 2019-01-23 18:10:06 +09:00
0d1aaee1dd
Merge changes If71fadd2,I42047185
* changes:
  [MS10] Address leftover comments on MS03 and MS07
  [MS09] Implement isSameNetwork.

Chalard Jean   authored and   Gerrit Code Review   commited 2019-01-22 22:50:21 +00:00
2b428221cb
Merge "Add API for VPN apps to query always-on and lockdown."
Pavel Grafov   authored and   Gerrit Code Review   commited 2019-01-22 14:43:06 +00:00
5e135e2bdc
[MS09] Implement isSameNetwork.
Test: Old tests pass, new tests pass too.
Bug: 113554482

Change-Id: I420471853f3fab7725cba7ae500cebdce1912e43

Chalard Jean   commited 2019-01-22 19:10:48 +09:00
7f8be9f6ca
Merge "Add NetworkStack metrics to system API"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-01-22 07:48:39 +00:00
bda2c4fe17
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

Lorenzo Colitti   commited 2019-01-22 10:53:00 +09:00
4433025623
Add NetworkStack metrics to system API
Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: Ie52c55f248c173e2a5ee603ecd004fbac9004ac1

Remi NGUYEN VAN   commited 2019-01-21 23:24:41 +00:00
c8bf99d5d9
Add API for VPN apps to query always-on and lockdown.
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Bug: 72628179
Change-Id: I73cb0888f7049b12ab0cdfa62678c3846e074d3b

Pavel Grafov   commited 2019-01-21 13:48:45 +00:00
e87b7ceaa6
[MS08] Read back attributes and blobs.
Test: New tests in IpMemoryStore
Bug: 113554482

Change-Id: I2ddfef0c2ed37459c038f75d1dfc92fdefbf58f5

Chalard Jean   commited 2019-01-21 15:21:09 +09:00
b8997229ad
Merge "Avoid calling ParcelFileDescriptor.fromSocket on new Sockets."
Josh Gao   authored and   Gerrit Code Review   commited 2019-01-18 22:25:35 +00:00
5ceb563f51
[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

Etan Cohen   commited 2019-01-17 16:30:05 -08:00
107ae95001
Test parceling empty LinkProperties.
Test: atest FrameworksNetTests
Change-Id: Iec53a9fdce1ba1db86751ea5f14a11d28be543eb

Lorenzo Colitti   commited 2019-01-15 12:53:59 +09:00
1d3bf3d90c
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

Lorenzo Colitti   commited 2019-01-15 11:13:07 +09:00
ae53ea1874
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

Lorenzo Colitti   commited 2019-01-12 02:16:34 +09:00
981b34f6b8
[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

Chalard Jean   commited 2019-01-11 15:01:00 +09:00
6dd2486300
[MS01] Add the IP memory store service.
Bug: 116512211
Test: Added initial tests
Change-Id: I9d9af4097e3e2d7afd9956b9cbfa29a9f9558ae0

Chalard Jean   commited 2019-01-11 15:00:36 +09:00
d3829de504
Merge "Move NetworkMonitor to NetworkStack"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-01-11 05:08:52 +00:00
b35979db6b
Move NetworkMonitor to NetworkStack
Bug: b/112869080
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1b8b6a3f4390adbabf92fb9e48da61c47b08b2ec

Remi NGUYEN VAN   commited 2019-01-11 09:59:11 +09:00
8539129ad9
Merge "Add PCSCF to LinkProperties."
Chalard Jean   authored and   Gerrit Code Review   commited 2019-01-10 05:55:05 +00:00
a99e1eeb9d
Merge "Ignore ipv6 tx traffic on clat uid."
Junyu Lai   authored and   Gerrit Code Review   commited 2019-01-04 09:29:10 +00:00
926c915708
[CM] Fix comments, add tests to TransportInfo API
Bug: 117605977
Test: atest NetworkCapabilitiesTest
Change-Id: I734ec56e44cd09d11ae81a856a53a26e1191b9a0

Etan Cohen   commited 2018-12-11 15:00:10 -08:00
73fb5a86f0
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

junyulai   commited 2018-12-10 15:19:03 +08:00
879dbfa624
Merge "Refactoring of deleting stats in NetworkStats based on uids."
Junyu Lai   authored and   Gerrit Code Review   commited 2018-12-10 05:15:28 +00:00
12924cb23b
Merge "[CS] Add a generic transport-specific information API"
Etan Cohen   authored and   Gerrit Code Review   commited 2018-12-09 03:53:44 +00:00
0e18882d5c
[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

Etan Cohen   commited 2018-12-07 17:37:48 +00:00
ac07cca084
Merge "Call netd to update the tcp buffer size"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-12-06 19:01:24 +00:00
a3713ac30d
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

junyulai   commited 2018-12-06 19:01:17 +09:00
edb60c461b
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>

Hongshik   commited 2018-12-05 22:05:49 +09:00
e2d7cf5aed
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

Luke Huang   commited 2018-11-28 13:41:58 +08:00
a904fab046
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

Chenbo Feng   commited 2018-11-27 15:37:52 -08:00
1541629a3f
Merge "PermissionMonitor: Move intent receiver to ConnectivityService."
Junyu Lai   authored and   Gerrit Code Review   commited 2018-11-27 01:48:59 +00:00
687cb5a0ed
Add XFRM-I support to IpSecService
This change adds support for XFRM-I to all IpSecService netd calls.
Fallback logic is in netd, and thus both VTI and XFRM-I parameters are
always passed down to IpSecService.

Bug: 78589502
Test: All java, CTS tests passing
Change-Id: Ie4186f0ad7e50763b21831f6fa411b5ee436de78

Benedict Wong   commited 2018-11-21 08:34:54 -08:00
12b70569f9
PermissionMonitor: Move intent receiver to ConnectivityService.
Currently, PermissionMonitor listen to user add/remove and
package add/remove intent respectively, and so does VPN.
Thus, races might occurr between them.

This commit refactor PermissionMonitor part by using
ConnectivityService to listen to intents and dispatch events
to PermissionMonitor.

Bug: 118811303
Test: 1. atest FrameworksNetTests
      2. manually add/remove package

Change-Id: I6e45b5870d5b1300cad252d25bdb4da78f9bf70e

junyulai   commited 2018-11-21 12:17:10 +09:00
df46b35279
Add IPv6 link-local address generation from EUI-48
Add a utility method to convert an EUI-48 to an IPv6 link-local
address based on RFC 4291 (EUI-64 generation) followed by RFC 4862.

Bug: 117605977
Test: atest MacAddressTest
Merged-In: I80b683e69da6beff3b37fc345fc15aa9610d09b7
Change-Id: I80b683e69da6beff3b37fc345fc15aa9610d09b7

Etan Cohen   commited 2018-11-16 21:50:24 -08:00
ec1c466cb0
Avoid calling ParcelFileDescriptor.fromSocket on new Sockets.
Previously, we were calling ParcelFileDescriptor.fromSocket on a newly
initialized Socket, which doesn't actually create a file descriptor
until the Socket is bound or connected.

Bind the Socket to a random port to force the file descriptor to be
allocated.

Test: treehugger
Change-Id: Id92a3e1316881d1c5382485aa2d6a41fc37e9651

Josh Gao   commited 2018-11-09 14:10:40 -08:00
bc2208a2a2
Merge "Use spy in PermissionMonitorTest."
Junyu Lai   authored and   Gerrit Code Review   commited 2018-11-09 08:47:03 +00:00
e666ae6ee5
Use spy in PermissionMonitorTest.
Bug: 118811303
Test: runtest frameworks-net
Change-Id: Id61a9efecf1d1ed5a9045b78ecfec9239e13967b

junyulai   commited 2018-11-09 12:37:16 +08:00
4ae90ee86e
Add skip464xlat test in Nat464XlatTest
Bug: 69949375
Test: Nat464XlatTest, ConnectivityServiceTest

Change-Id: Ibc66d9c2dc8e3d1f118e5f6940e7b3fd4646efd1

soma, kawata   authored and   Chalard Jean   commited 2018-11-06 06:02:50 +00:00
4d041d5caa
Merge "Support backward compatibility for restricted network permission"
Paul Hu   authored and   Gerrit Code Review   commited 2018-11-01 07:20:05 +00:00
3e8de1cade
Support backward compatibility for restricted network permission
Some native daemons legacy design work with SYSTEM_UID. If none of
SYSTEM_UID apps declare the restricted network permission, it will
result in permission denial in daemons. Allow SYSTEM_UID in the
devices shipped before Q to support backward compatibility.

Bug:114245686
Test: 1. runtest frameworks-net
      2. atest FrameworksNetTests
      3. Native daemons with SYSTEM_UID can work normally

Change-Id: I6f3f0d83bcae74ef5389535b528af3baf649fa48

paulhu   commited 2018-11-01 10:38:11 +08:00
8e38c05bb3
Fix negative uid stats caused by 464xlat adjust when eBPF is on.
When using xt_qtaguid to count per uid stats,
NetworkStatsService needs to adjust the 464xlat traffic since
iptables module would double count for ipv4 and ipv6 packet.
But for eBPF, the per uid stats is collected in a different
hook, so the adjustment on root uid would only be needed in tx
direction.

Bug: 112226716
Test: 1. Make ipv4 traffic in ipv6-only network and check data
         usage.
      2. Make ipv4 traffic in a client which connect to
         ipv6-only hotspot.
      3. runtest frameworks-net
      4. cts-tradefed run cts -m CtsNetTestCases -t \
                 android.net.cts.TrafficStatsTest
      5. cts-tradefed run cts -m CtsUsageStatsTestCases

Change-Id: Ic9a84f5446eddc943c255d5f3b89dad171f53cac

junyulai   commited 2018-10-30 21:23:38 +08:00
1d103a9809
No-op refactoring of VPN lockdown status check.
Currently, if VPN lockdown is disabled, the blocking judgement
inside VPN will return false immediately. It will make
ConnectivityService hard to check blocked status by a given
VPN lockdown status.

Thus, move this check into ConnectivityService and check it
externally.

Bug: 117814902
Test: 1. manual test with 3rd-party vpn app
      2. runtest frameworks-net

Change-Id: Ia8319b1a1a12f1058c24badf2431f2ec69bc78e7

junyulai   commited 2018-10-25 16:43:50 +08:00
e06923946c
Add tests for the network blocked status change
onBlockedStatusChanged is intruduced for network blocked status.
The changes in this patch are:
  - Test onBlockedStatusChanged which tells apps whether the
    network is blocked.
  - Fixed the tests which is affected by the order changed in
    onAvailable.

Test: as follows
    - runtest frameworks-net
    - runtest -x NetworkPolicyManagerServiceTest.java
Bug: 74575553
Change-Id: I383c037ed895ef69c478dc3cff69fb1e27c42845

Mike Yu   commited 2018-10-19 19:52:50 +08:00
96612aedb1
Check to ensure UDP-encap is used only for IPv4
This commit checks if UDP-encapsulation is used
for unsupported address family and throws
IllegalArgumentException when it happens.

Bug: 74213459
Test: Tests added in testCreateTransportModeTransformWithEncap
      and testCreateTunnelModeTransformWithEncap.
      Command: runtest frameworks-net
      Verified on taimen.
Change-Id: I10c01f2bad6aca23430849ea9ef6c1eb157ae131

evitayan   commited 2018-10-04 11:44:00 -07:00
e54eee0130
Add UDP encapsulation tests for IpSecService.
This commit adds tests to ensure that IpSecService properly
handles UDP-encapsulation transforms correctly.

Bug: 76110065
Test: Added: testCreateTransportModeTransformWithEncap,
             testCreateTunnelModeTransformWithEncap.
      Command: runtest frameworks-net
      Verified on taimen.
Change-Id: Ie05bc5354266806c2d03b0b3d73a4696a89eccf2

evitayan   commited 2018-10-04 10:37:47 -07:00
1ab508d361
Merge "Allow wifi and ethenet connected at same time."
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-10-02 17:09:16 +00:00
75e74f759d
Allow wifi and ethenet connected at same time.
This will improve the user experience on Android TV devices,
see bug for details.

In addition when connecting adb to the device by ethernet
for cts, wifi will not connect, causing lots of tests to fail.
For example:
[CTS7.1]android.net.wifi.cts.WifiInfoTest#testWifiInfoProperties
[CTS7.1]android.net.cts.ConnectivityManagerTest#testConnectivityChanged_
manifestRequestOnlyPreN_shouldReceiveIntent

Use command:settings to put global wifi_data_always_on 1 to enable it.

Bug: 26102779
Test: Manual, CTS.
Change-Id: I711d93061a6bc7164d98a858912f781e1b967406

Leif Hendrik Wilden   commited 2018-10-01 09:12:10 -07:00
838c66128f
Merge "Fix idle timer rule leakage"
Chiachang Wang   authored and   Gerrit Code Review   commited 2018-10-01 02:20:23 +00:00
c8019ecef2