Commit Graph

1295 Commits

Author SHA1 Message Date
Chalard Jean
157c444fcf Merge "Fix an argument to the legacy broadcast" 2019-04-23 00:38:10 +00:00
Benedict Wong
6934b250e2 Merge "Add NATT keepalive resources and methods into IpSecService" am: 8ab1de2439
am: 866cba5a1b

Change-Id: I3affb5bdbb0c3f980b6606d728668e74c31646d0
2019-04-22 13:44:20 -07:00
Benedict Wong
866cba5a1b Merge "Add NATT keepalive resources and methods into IpSecService"
am: 8ab1de2439

Change-Id: I97e7451959d619f42d68a5c29cca410bf0740852
2019-04-22 13:31:52 -07:00
TreeHugger Robot
43e577b152 Merge "Add smoke test for jni library" into qt-dev 2019-04-22 20:14:31 +00:00
Benedict Wong
8ab1de2439 Merge "Add NATT keepalive resources and methods into IpSecService" 2019-04-22 20:03:54 +00:00
Remi NGUYEN VAN
71a25d5827 Add tests for DhcpErrorEvent
The tests are run both in unit and CTS tests.
Test: atest FrameworksNetTests NetworkStackTestCases
Bug: 129200175

Change-Id: I52976bbbaca26fb317836e8461e372c25df02a22
2019-04-23 00:19:06 +08:00
Paul Hu
9dc3a9e437 Merge "Move more network unit tests to common tests" am: bce9cb271f
am: 457b5be451

Change-Id: I9f708a252ab606b782f5f828dce8c1690c3703bf
2019-04-22 07:30:55 -07:00
Paul Hu
457b5be451 Merge "Move more network unit tests to common tests"
am: bce9cb271f

Change-Id: Id130368cd87ed262ef8eb926adf7b80fc3d7c2e3
2019-04-22 07:20:08 -07:00
Paul Hu
bce9cb271f Merge "Move more network unit tests to common tests" 2019-04-22 13:59:25 +00:00
Chalard Jean
37a2b46f75 Fix an argument to the legacy broadcast
Test: new test for this
Fixes: 62650382
Change-Id: I918b8271d3c3c058553ca888cb54cd36a6efba66
2019-04-22 22:26:16 +09:00
Luke Huang
fdd11f803c Make DNS cache lifecycle management explicit
1. ConnectivityService calls netd binder to create/destroy network directly.
2. Call dnsresolver binder to create/destroy cache after create/destroy network.
3. Remove unused network create/destroy methods in NetworkManagementService.

Bug: 129453995
Test: atest FrameworksNetTests
Change-Id: I15660d27f735e33d621d4af8972cdf115bf76dfa
2019-04-22 17:43:37 +08:00
Chalard Jean
de9b8a9d7e Make LegacyTypeTracker testable
...and add basic trivial tests for it.

Test: this, and ConnectivityServiceTest
Bug: 62650382
Change-Id: Ie7ca938e6f66f1b15feb6ed93afa0aebb20884ae
2019-04-22 15:44:23 +09:00
Chalard Jean
36af3e6162 Merge changes Id598ae1d,I475bd011
am: 8fe63a3498

Change-Id: Ic02f8d900b6b430dc1a8bbfdc03297ad52157390
2019-04-21 19:29:00 -07: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
Chalard Jean
1395062bb4 Merge "Make LegacyTypeTracker testable" am: 54cedaca89
am: 080562b154

Change-Id: I53457ad6af430c551c6909a7e68127a3667efde9
2019-04-21 17:25:03 -07:00
Chalard Jean
080562b154 Merge "Make LegacyTypeTracker testable"
am: 54cedaca89

Change-Id: I7dd63d9676862d3416ff75b43f2f8bdbce07134a
2019-04-21 17:13:47 -07:00
Benedict Wong
bdf7048571 Add NATT keepalive resources and methods into IpSecService
This change adds a new NATTKeepalive resource type, along with the
associated allocation/deallocation. Additionally, this change allows
ReferenceCountedResource(s) to not be binder-linked, to allow the
ConnectivityService to verify ownership and allocate a NattKeepalive
without double-registering for binder-death notifications.

Bug: 125517194
Test: IpSecService frameworks tests ran
Change-Id: I8293f79940ad57dabb6f2b9de5e334d06b869443
2019-04-19 11:17:21 -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
cd616ebc95 Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable.
Test: built, flashed, booted
      atest FrameworksNetTests

Bug: 130788363
Change-Id: I3b4e8672f5273c3baa9378025bfaef2e6514df64
Merged-In: I6dc9029af0df0d3b391210bd315516bdf1b5e4c9
(cherry picked from commit 9e9fda7558a924feb86869fca7dc7fd7dd01a78c)
2019-04-18 11:06:51 +00:00
Wayne Ma
89ddc90b91 Merge "Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable." am: c9308bb32d
am: 009dcb2d12

Change-Id: I6dc9029af0df0d3b391210bd315516bdf1b5e4c9
2019-04-17 07:26:59 -07:00
Wayne Ma
009dcb2d12 Merge "Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable."
am: c9308bb32d

Change-Id: I429437f3f4c6f5159be907c287a9d59bceb537a5
2019-04-17 07:15:43 -07: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
Junyu Lai
2ffcae18d9 Merge "Release keepalive slot after stopped" am: 79c7b5a300
am: 82a0ddb40d

Change-Id: I8bf18f5dd10412f251071cea8140793b22c7fd95
2019-04-15 22:16:02 -07:00
Junyu Lai
82a0ddb40d Merge "Release keepalive slot after stopped"
am: 79c7b5a300

Change-Id: Ic707f22fb12c98c187e89cc8ad39773f61737506
2019-04-15 22:04:18 -07:00
Junyu Lai
79c7b5a300 Merge "Release keepalive slot after stopped" 2019-04-16 04:46:18 +00:00
Chenbo Feng
9b4ab05070 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
Merged-In: Id24e7f0558b5643e4ad7393e85f1f0a2bd875615
(cherry picked from commit 5f8a630da7d5b308c0824a25f6fc1dd4c7552c9f)
2019-04-15 19:02:56 -07: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
73a6ab946c Merge changes I4f181789,Ia8a0c99b am: 1744b240f6
am: c4ac34f834

Change-Id: Ib59e211d4329f885108de9ea0a74669ffb144e17
2019-04-12 06:37:28 -07:00
Lorenzo Colitti
c4ac34f834 Merge changes I4f181789,Ia8a0c99b
am: 1744b240f6

Change-Id: I50207fe29953be7759bbd01cb93268202067f764
2019-04-12 06:29:44 -07:00
Remi NGUYEN VAN
0539d81793 Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN"" am: 27a60a1aff
am: 8de7fec0d0

Change-Id: I3e1c408fcfc14db8b2586a79416233ffe9e1173d
2019-04-12 06:24:30 -07: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
8de7fec0d0 Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
am: 27a60a1aff

Change-Id: I601649e15c97a8fd1732c4d38dab9d5556c5f175
2019-04-12 03:41:01 -07: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
Rubin Xu
131a0722cc Merge "Block incoming non-VPN packets to apps under fully-routed VPN" am: fd20f8da0a
am: 8951473446

Change-Id: I5af81bc80dadd086261ba4b1eb706cc873bb7cfa
2019-04-11 11:45:43 -07:00
Rubin Xu
8951473446 Merge "Block incoming non-VPN packets to apps under fully-routed VPN"
am: fd20f8da0a

Change-Id: I321a96599e51b70817b2514455c43972cd1fbca8
2019-04-11 09:56:11 -07:00
Rubin Xu
fd20f8da0a Merge "Block incoming non-VPN packets to apps under fully-routed VPN" 2019-04-11 16:46:16 +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
Chenbo Feng
93967660a1 Merge "Add smoke test for jni library" am: 98ad72632c
am: 22f45a249d

Change-Id: Iba607c906917017f79f141f4e0599a2330cc0f14
2019-04-10 00:01:28 -07:00
Chenbo Feng
22f45a249d Merge "Add smoke test for jni library"
am: 98ad72632c

Change-Id: Iedb44739539f63090b067c1a25d4e83c333caddb
2019-04-09 23:50:10 -07:00
Treehugger Robot
98ad72632c Merge "Add smoke test for jni library" 2019-04-10 06:30:26 +00: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
608168402b 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: Ib955acaa5e498c0e977cb5f2e48cffbc9fea8c7c
Merged-In: I6db75853da9f29e1573512e26351623f22770c5d
Merged-In: I416c2e43961ec0e1cc6b2fbcef970fbce858603b
Merged-In: Ib955acaa5e498c0e977cb5f2e48cffbc9fea8c7c
(cherry picked from commit 6c089d90bfa728e9842de0f5947f0c557c62dea0)
2019-04-09 21:37:26 +00:00
Benedict Wong
b64f22c9b4 Merge "Fix remove-before-add for IpSecService RefcountedResource" am: 342d6de289
am: 15b70fe885

Change-Id: I416c2e43961ec0e1cc6b2fbcef970fbce858603b
2019-04-09 10:56:30 -07:00
Benedict Wong
15b70fe885 Merge "Fix remove-before-add for IpSecService RefcountedResource"
am: 342d6de289

Change-Id: Ief286a54a93efd731deeff9fc32815663ab7695d
2019-04-09 10:39:16 -07:00
Benedict Wong
342d6de289 Merge "Fix remove-before-add for IpSecService RefcountedResource" 2019-04-09 17:22:56 +00:00