Commit Graph

2072 Commits

Author SHA1 Message Date
Luke Huang
fbd8ecfe17 Correct buffer size limitation for DnsResolver API
Bug: 131055651
Test: atest DnsResolverTest
Change-Id: I29decd480172eacb452ccb0da524ef1bf2ffadcf
2019-05-02 11:48:54 +08:00
TreeHugger Robot
65caa406e7 Merge changes from topic "natt-aidl+aidl-freeze" into qt-dev
* changes:
  Add AIDL parcelable for NattKeepalivePacketData
  Move NattKeepalivePacketData out of the framework
2019-04-29 16:26:23 +00:00
Aaron Huang
8cf997d1c1 Move NattKeepalivePacketData out of the framework
For implementing parcelable interface for NattKeepalivePacketData.
Move this class out of framework.jar and move to services.jar

This class is used in telephony-common.jar and it also loads
service.jar.

Bug: 33530442
Test: - build pass
      - atest NetworkStackTests
      - atest ConnectivityServiceTest

Change-Id: Ie1d02bb7bccb76415cf71824147466cabf6b88b6
Merged-In: Ie1d02bb7bccb76415cf71824147466cabf6b88b6
Merged-In: Idf7c25b6b553d8c0cc4ef2ea8193438480420fb4
(cherry picked from commit 58a1f931eba8716c4a630863f658b070cda623de)
2019-04-29 20:24:24 +08:00
Rubin Xu
dc587d75e1 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

Merged-In: I5af81bc80dadd086261ba4b1eb706cc873bb7cfa
Change-Id: I5af81bc80dadd086261ba4b1eb706cc873bb7cfa
(cherry picked from commit 65968ea16bf49f678d4a43c220e1d67393170459)
2019-04-24 11:56:46 +01:00
Aaron Huang
82184fd8ce Merge "Move NattKeepalivePacketData out of the framework" am: d3ee38785b
am: 382b3d2a63

Change-Id: Idf7c25b6b553d8c0cc4ef2ea8193438480420fb4
2019-04-23 21:26:03 -07:00
Aaron Huang
d3ee38785b Merge "Move NattKeepalivePacketData out of the framework" 2019-04-24 04:00:56 +00:00
Benedict Wong
8b2466b437 Merge "Add configurability of LinkProperties, meteredness for Test Networks" am: a57dada482
am: 248e00b41e

Change-Id: I9c8220efd56f72aabae028b48ac2f88ec7b8f659
2019-04-22 11:18:52 -07:00
TreeHugger Robot
3f6b2004ce Merge "Restrict access to dangerous methods to <= P" into qt-dev 2019-04-22 07:14:10 +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
Aaron Huang
f7adc47367 Move NattKeepalivePacketData out of the framework
For implementing parcelable interface for NattKeepalivePacketData.
Move this class out of framework.jar and move to services.jar

This class is used in telephony-common.jar and it also loads
service.jar.

Bug: 33530442
Test: - build pass
      - atest NetworkStackTests
      - atest ConnectivityServiceTest

Change-Id: Id2fdec5c4015d2cefd8a93e0cfdcc3c304fc9b64
2019-04-20 00:37:19 +08:00
Luke Huang
830600090c Fix DnsResolver API could not bypass private DNS correctly
Bug: 130594022
Test: atest DnsResolverTest

Merged-In: Ic9e078f8acf7688850dfe31f15ed065739ad5281
(cherry picked from commit c21eb1fb31dff7b05aabbbc2f45caf587095abc3)

Change-Id: I1788157c784b0ec124bd7d78ba90278b5501d0d4
2019-04-16 12:41:02 +00:00
Luke Huang
e45f6e2d0d Merge "Fix DnsResolver API could not bypass private DNS correctly" am: 9c138c7a13
am: 5410ef4882

Change-Id: Ib2f8ae73e2a9d76d87243d53cac1157032156082
2019-04-16 02:27:28 -07:00
Luke Huang
9c138c7a13 Merge "Fix DnsResolver API could not bypass private DNS correctly" 2019-04-16 09:03:22 +00:00
Chalard Jean
6fb1669b65 Restrict access to dangerous methods to <= P
Test: make
Fixes: 130143562
Change-Id: I1a6a472f83cf00a1ab174a9c5e67d3e9357a0c45
Merged-In: I95107f7b628eecb54e9f4411785186b668e9f3d8
Merged-In: I890030580fdad45c3f8589bf6adbe5798d578cfe
(cherry picked from commit 0bb53dbb64bbc937a23e1dc7641c8988a6d11d64)
2019-04-16 06:13:09 +00:00
Chalard Jean
22178e1557 Merge "Restrict access to dangerous methods to <= P" am: 861e9b56bd
am: acb2474e18

Change-Id: I95107f7b628eecb54e9f4411785186b668e9f3d8
2019-04-15 22:39:08 -07:00
Chalard Jean
861e9b56bd Merge "Restrict access to dangerous methods to <= P" 2019-04-16 05:17:20 +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
Lorenzo Colitti
73a6ab946c Merge changes I4f181789,Ia8a0c99b am: 1744b240f6
am: c4ac34f834

Change-Id: Ib59e211d4329f885108de9ea0a74669ffb144e17
2019-04-12 06:37:28 -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
Luke Huang
7dcaa056a6 Merge "API council feedbacks for DnsResolver" am: 3436bc64ca
am: d836f86f4b

Change-Id: Id731f73f25f437df94f936e9a3ec227b797b6031
2019-04-12 05:31:10 -07: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
Luke Huang
0494f8833d API council feedbacks for DnsResolver
To address the API review feedback provided by
the API council.

Bug: 129261432
Test: atest DnsResolverTest

Merged-In: I5737cf293264bf9d492e7bd56b62bee4d49002eb
(cherry picked from commit 454fe010dcacd38211b857d2b235ed37269e3b7e)

Change-Id: I429dd93285f50314e9d757f4ec8539a3ba40e61b
2019-04-12 06:23:01 +00:00
TreeHugger Robot
0301854863 Merge changes I98573a5c,Ic7394f24 into qt-dev
* changes:
  Enable checks for MANAGE_TEST_NETWORKS in TestNetworkService
  Cleanup of Test Network service
2019-04-12 00:54:45 +00:00
Luke Huang
3436bc64ca Merge "API council feedbacks for DnsResolver" 2019-04-12 00:45:18 +00:00
Benedict Wong
a66baf749b 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
Merged-In: Ic7394f24f11d713c9374b438182e29d2a02ea236
(cherry picked from commit 7df36ed96a807f258aef43e558ef127b27b90756)
2019-04-11 20:04:06 +00: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
Lorenzo Colitti
124a130abe Merge "Add support for TAP interfaces in TestNetworkManager." am: 144e714d79
am: 878d818c63

Change-Id: I29daac925c4b64bda111ba187b1759b6ce8a5f23
2019-04-11 11:32:46 -07:00
Benedict Wong
8cb5bb604b Merge changes I98573a5c,Ic7394f24 am: 0855a3c457
am: 9567abb46b

Change-Id: I279765199a80b0639dde31302778a95c0f9fd705
2019-04-11 10:05:20 -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
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
28a9894888 Add support for TAP interfaces in TestNetworkManager.
Bug: 72950854
Test: builds, boots
Change-Id: I88bfd7f37c0ba0228f8288fe92212618ce134e4f
Merged-In: I88bfd7f37c0ba0228f8288fe92212618ce134e4f
(cherry picked from commit ba2eb5e0621c4f2a2c86a641998b4ae1953ae4b8)
2019-04-11 12:04:23 +00: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
Remi NGUYEN VAN
747c63e385 Merge "Fix comment on StaticIpConfiguration#getDomains" am: 4aca98b5f5
am: 26174b9b95

Change-Id: I6a2ff0368193aaa988585613d99662a01cf4fa26
2019-04-10 00:07:05 -07:00
Treehugger Robot
4aca98b5f5 Merge "Fix comment on StaticIpConfiguration#getDomains" 2019-04-10 06:30:55 +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
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
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
Remi NGUYEN VAN
1da5fac070 Move attach*Filter() and addArpEntry() methods to NetworkStack
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods
were added there because they could not be added as JNI inside
the NetworkStack. This was not possible because on Go devices,
the NetworkStack was a jar library. But now, Go also uses an APK.
Hence, move these methods to the NetworkStack.

Fixes: 129433183
Merged-In: I66d7b3e4fbfa32bb0bc853e8cf9399031daff8a9
(cherry picked from commit fe71be2b04a3213828dc0347a1dd4a3675d20562)

Change-Id: Ice433a41469e784385f19498c154345d7b9c69b5
2019-04-08 01:41:39 +00:00
Remi NGUYEN VAN
85c61fc88d Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack" am: 82b74785d7
am: 6dad7305af

Change-Id: If5c236c85585a440bfb645cff9d3cb0bb4e11102
2019-04-05 03:31:36 -07:00
Remi NGUYEN VAN
82b74785d7 Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack" 2019-04-05 06:38:08 +00:00
Mark Chien
5ca20d48aa Merge "Some cleanups for Tethering" am: 7cf4907b89 am: 997009af45
am: e28dc820e4

Change-Id: I0f5c8f33f13dfa2366992a2b2e0ada7667b90e2f
2019-04-03 03:54:42 -07:00
Mark Chien
7cf4907b89 Merge "Some cleanups for Tethering" 2019-04-03 10:16:25 +00:00
paulhu
fd7c030082 Move attach*Filter() and addArpEntry() methods to NetworkStack
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods
were added there because they could not be added as JNI inside
the NetworkStack. This was not possible because on Go devices,
the NetworkStack was a jar library. But now, Go also uses an APK.
Hence, move these methods to the NetworkStack.

Change-Id: I1d88a0f0be23f2b15d5103fa092b9bf982329d7c
Fix: 129433183
Test: atest NetworkStackTests FrameworksNetTests
2019-04-03 17:49:36 +08:00
Remi NGUYEN VAN
99d282d2f6 Merge "Fix API in CaptivePortal, StaticIpConfiguration" am: cf0f380f4e am: fb943d00ca
am: 69528af3db

Change-Id: Icda65fe4a009a754b6a1a763d402820652d55391
2019-04-03 02:28:11 -07:00
Remi NGUYEN VAN
9ed32081bf Fix comment on StaticIpConfiguration#getDomains
Add consistency with setDomains().

Test: m
Change-Id: I9ff2de98cec2caf903310d7e8eb7b32362c0e151
2019-04-03 15:55:15 +09:00
Remi NGUYEN VAN
cf0f380f4e Merge "Fix API in CaptivePortal, StaticIpConfiguration" 2019-04-03 06:51:35 +00:00