Commit Graph

5795 Commits

Author SHA1 Message Date
Benedict Wong
a57dada482 Merge "Add configurability of LinkProperties, meteredness for Test Networks" 2019-04-22 17:41:20 +00:00
Paul Hu
bce9cb271f Merge "Move more network unit tests to common tests" 2019-04-22 13:59:25 +00:00
Chalard Jean
8fe63a3498 Merge changes Id598ae1d,I475bd011
* changes:
  Fix a possible crash when the listener is null
  Straighten AIDL interface for the memory store
2019-04-22 02:15:04 +00:00
Chalard Jean
08c2d9e81f Straighten AIDL interface for the memory store
Some names were still wrong somehow, and the wrappers were
missing.

Test: NetworkStack & FrameworkNetTests
Change-Id: I475bd011ad9bc714a07021a9dfd85c4876f8e9ad
Merged-In: I475bd011ad9bc714a07021a9dfd85c4876f8e9ad
2019-04-22 00:40:28 +00:00
Benedict Wong
6259ad2be9 Add configurability of LinkProperties, meteredness for Test Networks
This commit adds the ability to pass in LinkProperties and meteredness
for additional testing use cases.

Bug: ?
Test: Compiles. Test utility only.
Change-Id: Idf6c3bcae2dea5e61c0418b72b889496919be8ba
2019-04-19 10:46:56 -07:00
Chalard Jean
3a3f5f2a08 Make LegacyTypeTracker testable
...and add basic trivial tests for it.

Test: this, and ConnectivityServiceTest
Bug: 62650382
Change-Id: Ie7ca938e6f66f1b15feb6ed93afa0aebb20884ae
2019-04-19 15:33:44 +09:00
Wayne Ma
c9308bb32d Merge "Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable." 2019-04-17 13:58:11 +00:00
waynema
7b76545b94 Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable.
Test: built, flashed, booted
      atest FrameworksNetTests

Change-Id: I3b4e8672f5273c3baa9378025bfaef2e6514df64
2019-04-17 13:55:53 +00:00
Chalard Jean
2a9f0c45f4 Merge "Move TrafficStats tags for the network stack constants" 2019-04-17 05:45:56 +00:00
Chalard Jean
39d4d02520 Move TrafficStats tags for the network stack constants
As per API council feedback, these constants should live in
a place that is private to the network stack, only with a
range defined in system API.

Bug: 129433383
Test: m
Change-Id: I84a90f84a9af6fef4667ee4d512ebd0413222086
Merged-In: I4882686a86e7c6d42f4b0619b921d02619ed6d4c
Merged-In: I9b648ed6c687d56db61a54570c7880c51c1bae51
2019-04-17 05:45:40 +00:00
Luke Huang
9c138c7a13 Merge "Fix DnsResolver API could not bypass private DNS correctly" 2019-04-16 09:03:22 +00:00
Chalard Jean
861e9b56bd Merge "Restrict access to dangerous methods to <= P" 2019-04-16 05:17:20 +00:00
Junyu Lai
79c7b5a300 Merge "Release keepalive slot after stopped" 2019-04-16 04:46:18 +00:00
Luke Huang
4c349d2ed2 Fix DnsResolver API could not bypass private DNS correctly
Bug: 130594022
Test: atest DnsResolverTest
Change-Id: Ibf3edac3075d921d189237c485871efb869b320b
2019-04-16 11:57:45 +08:00
junyulai
e1bed4ddfa Release keepalive slot after stopped
Currntly, keepalive slot is released when stop() is called. Next
starting keepalive can use the same slot number while previous
keepalive is still stopping. When the previous keepalive is
stopped, the incoming as will be processed by the new keepalive.

This change release keepalive slot after the result of stopping
has returned. Thus, newly created keepalive cannot allocate the
same slot number while lower layer is still processing stop event.

This change also disable flaky assertions that are caused by
test port has been occupied by other process.

Bug: 129512753
Test: 1. atest com.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 100
      2. atest FrameworksNetTests --generate-new-metrics 10
      3. simulate the fail case manually.

Change-Id: I1991627545519ee5cb408a3df3a006f710f4af7b
2019-04-15 17:44:48 +08:00
Lorenzo Colitti
1744b240f6 Merge changes I4f181789,Ia8a0c99b
* changes:
  Revert new tests and PackageManager mock
  Revert "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
2019-04-12 13:11:18 +00:00
Lorenzo Colitti
44c6efb9c1 Revert new tests and PackageManager mock
A mocked PackageManager caused test failures in existing tests.
Revert that for now to make tests pass again.

Bug: 114231106
Bug: 130397860
Test: atest FrameworksNetTests
Change-Id: I4f181789152438f18e6cd2d235d76fabe3872ea3
2019-04-12 19:52:45 +09:00
Lorenzo Colitti
bad9d911b8 Revert "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
This reverts commit bc571c7cc8.

Reason for revert: Rolling forward, will fix tests in same CL stack.

Bug: 114231106
Bug: 130397860
Test: FrameworksNetTests
Change-Id: Ia8a0c99b4e1fd5dff26c881715cd876618ca4321
2019-04-12 19:52:32 +09:00
Remi NGUYEN VAN
27a60a1aff Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN"" 2019-04-12 10:25:46 +00:00
Remi NGUYEN VAN
bc571c7cc8 Revert "Block incoming non-VPN packets to apps under fully-routed VPN"
This reverts commit 4773027064.
This change does not have any topic: not reverting the other 2 commits in the original topic.

Reason for revert: broke FrameworksNetTests presubmit: b/130397860

Change-Id: Iff41d9fe97fafea44680c8d67d1ce19277548cc0
2019-04-12 09:05:40 +00:00
Remi NGUYEN VAN
5564d5a8f6 Move more network unit tests to common tests
This adds the moved tests to CTS as well.
The moved unit tests are appropriate for CTS as they test data holder
classes that need to function properly for apps to work.

Test: atest FrameworksNetTests
Test: atest CtsNetTestCases: added tests pass
Bug: 129199900
Change-Id: I4c3d31ed595024af84093ca9110ed43633c383f4
2019-04-12 14:51:22 +09:00
Luke Huang
3436bc64ca Merge "API council feedbacks for DnsResolver" 2019-04-12 00:45:18 +00:00
Rubin Xu
fd20f8da0a Merge "Block incoming non-VPN packets to apps under fully-routed VPN" 2019-04-11 16:46:16 +00:00
Luke Huang
81cec00c55 API council feedbacks for DnsResolver
To address the API review feedback provided by
the API council.

Bug: 129261432
Test: atest DnsResolverTest
Change-Id: I3de11c913682abf790850b45cd5d50ac28b3fc5c
2019-04-11 22:17:20 +08:00
Lorenzo Colitti
144e714d79 Merge "Add support for TAP interfaces in TestNetworkManager." 2019-04-11 11:45:40 +00:00
Benedict Wong
0855a3c457 Merge changes I98573a5c,Ic7394f24
* changes:
  Enable checks for MANAGE_TEST_NETWORKS in TestNetworkService
  Cleanup of Test Network service
2019-04-10 17:06:17 +00:00
Rubin Xu
4773027064 Block incoming non-VPN packets to apps under fully-routed VPN
When a fully-routed VPN is running, we want to prevent normal apps
under the VPN from receiving packets originating from any local non-VPN
interfaces. This is achieved by using eBPF to create a per-UID input
interface whitelist and populate the whitelist such that all
non-bypassable apps under a VPN can only receive packets from the VPN's
TUN interface (and loopback implicitly)

This is the framework part of the change that build the whitelist.
The whitelist needs to be updated in the following cases:
* When a VPN is connected and disconnected
    This will cover the change to allowBypass bit, since that can't be
    changed without reconnecting.
* When a VPN's NetworkCapabilites is changed (whitelist/blacklist app changes)
* When a new app is installed
* When an existing app is removed
* When a VPN becomes fully-routed or is no longer fully-routed

New user/profile creation will automatically result in a whitelist app change
transition so it doesn't need to be handled specially here.

Due to the limitation of the kernel IPSec interacting with eBPF (sk_buf->ifindex
does not point to the virtual tunnel interface for kernel IPSec), the whitelist
will only apply to app VPNs but not legacy VPN connections, to prevent breaking
connectivity with kernel IPSec entirely.

Test: atest PermissionMonitorTest
Test: atest android.net.RouteInfoTest
Test: atest com.android.server.ConnectivityServiceTest
Test: atest HostsideVpnTests
Bug: 114231106
Change-Id: I143b03d60e46cb1b04732b4a4034f5847b4d1b1a
2019-04-10 17:05:54 +01:00
Treehugger Robot
4aca98b5f5 Merge "Fix comment on StaticIpConfiguration#getDomains" 2019-04-10 06:30:55 +00:00
Treehugger Robot
98ad72632c Merge "Add smoke test for jni library" 2019-04-10 06:30:26 +00:00
Lorenzo Colitti
93fac2892e Add support for TAP interfaces in TestNetworkManager.
Test: builds, boots
Change-Id: I88bfd7f37c0ba0228f8288fe92212618ce134e4f
2019-04-10 13:29:41 +09:00
Benedict Wong
ff9d0bab2c Enable checks for MANAGE_TEST_NETWORKS in TestNetworkService
This commit re-enables enforcement of the MANAGE_TEST_NETWORK
permission, which is only granted to the shell. CTS tests using this
permission should use UiAutomation.adoptShellPermissionIdentity() to
gain access.

Bug: 72950854
Test: IPsec CTS tests using this passing
Change-Id: I98573a5c68e45abbbaddef01f6ac74a6a18e26f9
2019-04-09 21:23:50 -07:00
Benedict Wong
8856354a8a Cleanup of Test Network service
This follow-up change performs some cleanup changes without affecting
functionality

Bug: 72950854
Test: Compiles, CTS tests using this pass
Change-Id: Ic7394f24f11d713c9374b438182e29d2a02ea236
2019-04-09 16:34:35 -07:00
Chenbo Feng
ba01e6c570 Add smoke test for jni library
Since the Framework net test require jni library
libnetworkstatsfactorytestjni, but the test fails to load that library
unless *all* the dependencies of that library are explicitly listed in
jni_libs, whenever any of the dependencies changes the framework net
test will start failing and it might not be catched since the change
might not related to frameworks/base. And this smoke test is aimed to
spot those native library changes and it should be stable enough to put
in global presubmit.

Bug: 124764595
Test: FrameworksNetSmokeTests
Change-Id: Id24e7f0558b5643e4ad7393e85f1f0a2bd875615
2019-04-09 14:45:35 -07:00
Benedict Wong
342d6de289 Merge "Fix remove-before-add for IpSecService RefcountedResource" 2019-04-09 17:22:56 +00:00
Junyu Lai
eb70ae41c6 Merge "Fix onBlockedStatusChanged does not work on multiple networks" 2019-04-09 12:13:26 +00:00
Chalard Jean
a3b77516bc Restrict access to dangerous methods to <= P
Test: make
Fixes: 130143562
Change-Id: I1a6a472f83cf00a1ab174a9c5e67d3e9357a0c45
2019-04-09 15:47:25 +09:00
Chalard Jean
3753f67bcd Merge "Address leftover comments on aosp/894233" 2019-04-09 05:51:18 +00:00
Remi NGUYEN VAN
55319378ee Merge "Expose captive portal urls for configuration" 2019-04-09 04:37:48 +00:00
Chalard Jean
ce140af98c Address leftover comments on aosp/894233
Bug: 129510344
Test: m, boots, wifi connects, resolves DNS
Change-Id: Idf24f42a86bbfcc89e3ea8cf50d1b705d72ac613
2019-04-09 12:03:28 +09:00
Benedict Wong
2d9864ab3c Fix remove-before-add for IpSecService RefcountedResource
This patch fixes a bug where if a binder dies before the linkToDeath
call, the cleanup will be performed before the entry is added to the
array. While it is safe in that quotas and tracking performs as per
normal, the RefcountedRecord may not be cleaned up.

Rethrowing this exception is safe, since the only paths that would hit
this are all on binder threads coming from applications. Further, it
seems there is only one real way of this getting hit - if the app that
called the creation died during the binder call.

Bug: 126802451
Test: Compiled, CTS tests passing
Change-Id: I6db75853da9f29e1573512e26351623f22770c5d
2019-04-08 18:51:50 -07:00
Niklas Lindgren
fd6f92eaa2 Expose captive portal urls for configuration
Carriers in Mainland China need to customize certain captive portal
urls. The main issue is that google servers are not accessible in
Mainland China.

Added the following captive portal resources to be targeted for overlay.
- config_captive_portal_http_url
- config_captive_portal_https_url
- config_captive_portal_fallback_urls (string-array)
- config_captive_portal_fallback_probe_specs (string-array)

These values can be customized for e g diffent countries

Bug: 111819230
Test: atest FrameworksNetTests NetworkStackTests
Test: Add a product RRO that targets a specific country code,
insert a SIM card that matches that country code and check the log
what URL is used.
Change-Id: I38a294a5e14417f65e96e76235ea153c53c4d7cc
2019-04-09 10:23:53 +09:00
Treehugger Robot
eade5d227d Merge "Add FrameworksNetTests dependency on libcgrouprc" 2019-04-08 10:19:26 +00:00
junyulai
7509e6e053 Fix onBlockedStatusChanged does not work on multiple networks
There is a logic error in maybeNotifyNetworkBlockedForNewUidRules
that caused function to return if there is no status change in
the first network. This would cause CTS failed in devices which
has volte-enabled SIM inserted.

Bug: 129409153
Fix: 117969394
Test: 1. atest com.android.cts.net.HostsideNetworkCallbackTests \
         --generate-new-metrics 20
      2. atest FrameworksNetTests

Change-Id: Ifd18d1c6ad708c1dbc793f03d8241f572af50317
2019-04-08 17:15:52 +08:00
Remi NGUYEN VAN
ecbcb7fbfc Add FrameworksNetTests dependency on libcgrouprc
The tests are currently broken without this dependency.

Bug: 129902619
Test: atest FrameworksNetTests
Merged-In: Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8
Change-Id: I85891485157ed86e069039dfe3092028ff703dd5
2019-04-08 17:34:47 +09:00
Treehugger Robot
1470d8a3b8 Merge "Extend support for requestRouteToHostAddress for backward compatibility" 2019-04-07 23:48:32 +00:00
Treehugger Robot
c832132056 Merge "Move NetworkStatsFactory into service directory" 2019-04-05 19:27:22 +00:00
Anil Admal
e1a2886f73 Extend support for requestRouteToHostAddress for backward compatibility
The gnss@2.0 HAL and the framework GNSS Location Provider code is
updated in Q to not call the deprecated requestRouteToHost() method.
However, devices upgrading to Q which are still using gnss@1.1 or
earlier HAL must continued to be supported.

Fixes: 121222025
Test: Tested with gnss@1.1 HAL and first API level P.  The
      ConnectivityService log message "This method exists only for
      app backwards compatibility and must not be called by system
      services" is not present for devices with first API level P.

Change-Id: I10199776ea413dc256dbf0771e6cb3eedb334495
2019-04-05 10:06:37 -07:00
Remi NGUYEN VAN
82b74785d7 Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack" 2019-04-05 06:38:08 +00:00
Remi NGUYEN VAN
c7b33f7572 Merge "Call clearCallingIdentity before notifyDnsResponse" 2019-04-05 01:54:08 +00:00
Treehugger Robot
e2908b64dd Merge "Add common tests for FrameworksBaseTests and CTS" 2019-04-04 12:29:44 +00:00