Commit Graph

6902 Commits

Author SHA1 Message Date
Chalard Jean
31740e4ed3 Update throws documentation for requestNetwork*
Bug: 78126688
Test: builds
Change-Id: I8b5bb052bf73feed0dfafafaf44fcd07f58186ce
2019-05-14 22:16:29 +09:00
Paul Hu
a4980fc1fd Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission" am: c381068caa
am: fb8186d0a9

Change-Id: I1025da29beb53259f57bd9ca5648b32f2847ed4a
2019-05-14 04:17:29 -07:00
Paul Hu
fb8186d0a9 Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission"
am: c381068caa

Change-Id: I065b5403d2f89d158e76f63c9b125ad30e603633
2019-05-14 04:06:04 -07:00
Paul Hu
c381068caa Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission" 2019-05-14 10:48:48 +00:00
paulhu
de3a2452a0 Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission
Caller should get SecurityException if called
ConnectivityManager#startCaptivePortalApp() w/o
MAINLINE_NETWORK_STACK permission. But now it will not get any
exception and can launch captive portal app successfully.

Bug: 132662433
Test: atest android.net.cts.ConnectivityManagerTest#testStartCaptivePortalApp
      w and w/o MAINLINE_NETWORK_STACK permission
Test: atest FrameworksNetTests NetworkStackTests

Change-Id: I61be1b0647f4165665a2d4166311adeac956e0d4
2019-05-14 18:44:16 +08:00
Chenbo Feng
2bebfc2b87 Clean up the permission control code in framework
Delete the unused NetworkManagementService API for set/remove
permissions. Use PERMISSION_NONE to replace NO_PERMISSIONS so the
framework now use the same set of permission constant when communicate
with netd.

Bug: 128944261
Test: PermissionMonitorTest.java

Change-Id: I25224c9576f52d2a0a0bd2182325c7aac7b28eb5
Merged-In: I25224c9576f52d2a0a0bd2182325c7aac7b28eb5
(cherry picked from commit 05887f99c6ca6885db737af2f356023dc6de80a2)
2019-05-13 14:22:58 -07:00
Chenbo Feng
9313f7adf9 Merge "Clean up the permission control code in framework" am: 0e6d2b5f4f
am: 6cb0c1579d

Change-Id: I1af059171c5d80be7abaee636f012f3b55dac2df
2019-05-13 11:32:59 -07:00
Chenbo Feng
6cb0c1579d Merge "Clean up the permission control code in framework"
am: 0e6d2b5f4f

Change-Id: Iff2316f72df4cff56829b281882dc920d63937bd
2019-05-13 11:20:31 -07:00
Treehugger Robot
0e6d2b5f4f Merge "Clean up the permission control code in framework" 2019-05-13 18:04:50 +00:00
Aaron Huang
81c72fc6c0 [automerger skipped] Merge "Send message to add/remove NAT-T keepalive packet filter." into qt-dev
am: 31e7bbccb1 -s ours
am skip reason: change_id Ic97ffe9ff5781778efd264460809f5059f0f4230 with SHA1 77abd94876 is in history

Change-Id: I40a476b7bb8b4cff1107e5786f5da2900ef0462f
2019-05-13 07:52:13 -07:00
junyulai
8a11b43814 [automerger skipped] Merge changes from topic "cleanupkeepalive" into qt-dev
am: c31ccecf6c -s ours
am skip reason: change_id I0481a469ee23231e5f0ab738a06b5e09f6cdb680 with SHA1 6e2c653c6e is in history

Change-Id: Ib6b1225fa45270974cce121a60e46f49f79e68ec
2019-05-13 07:42:08 -07:00
Junyu Lai
029da6e8f7 Merge "Fix concurrent modification exception in KeepaliveTracker" am: 7da0d7f02e
am: 5fb8a1d525

Change-Id: I6221bdff630ebef88bfd9d609e31a0f9ede036ad
2019-05-13 03:52:25 -07:00
Aaron Huang
4f4d8cb417 Send message to add/remove NAT-T keepalive packet filter.
Remove definition of TYPE_NATT and TYPE_TCP since the type
can be identified by checking message.obj is an instance of
NattKeepalivePacketData or TcpKeepalivePacketData.
It's more simple and won't have dependency on KeepaliveInfo.

Bug: 33530442
Test: atest FrameworksNetTests
      atest NetworkStackTests

(Clean cherry-pick of aosp/955419)

Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230
Merged-In: Ic97ffe9ff5781778efd264460809f5059f0f4230
2019-05-13 18:48:19 +08:00
junyulai
714801ec75 Fix concurrent modification exception in KeepaliveTracker
In aosp/951200, the clean up function delete the item in the
hash map that holds the record while iterating it, where the
list used to iterate the records is backed by the hash map,
so changes to the map are reflected in the list and caused
the concurrent modification exception.

Bug: 132341736
Test: 1. atest com.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 300
      2. atest FrameworksNetTests --generate-new-metrics 10

(Clean cherry-pick of aosp/959599)

Change-Id: I9cdfe6f6d11c5400c856cc30a33ff4a44ba9d811
Merged-In: I0481a469ee23231e5f0ab738a06b5e09f6cdb680
2019-05-13 18:44:39 +08:00
Junyu Lai
2c84918729 Clean up the keepalive slots when network disconnect
In general, keepalive slots are released after result of
stopping has returned. However, for network disconnect case,
the service side cannot communicate with network agent since
the async channel is broken.

Clean up keepalive slots right after stop in this case.

Bug: 132341736
Test: 1. atest com.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 100
      2. atest FrameworksNetTests --generate-new-metrics 10

Change-Id: Id3e4e159713c0ed7e03f45169e87b73ae6408e4f
(cherry picked from commit a5f6bd16062fba89bcf900aca93aa3514d93f662)
Merged-In: Id3e4e159713c0ed7e03f45169e87b73ae6408e4f
Merged-In: Icb5a1b5bb10617aa5a7b35db6cf48db3dc53b7fd
2019-05-13 18:43:00 +08:00
Junyu Lai
5e135ee2b9 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: I790f6bbc5efc3f088034ac45ec379da5f781d0ca
Merged-In: I1991627545519ee5cb408a3df3a006f710f4af7b
(cherry picked from commit 3523a3d02a1f88a3990ab9cc4948c705ecc713c8)
2019-05-13 18:42:19 +08:00
Junyu Lai
5fb8a1d525 Merge "Fix concurrent modification exception in KeepaliveTracker"
am: 7da0d7f02e

Change-Id: Ibd23240fdf8fb56b4216e2482152f605374f76db
2019-05-13 03:39:29 -07:00
Junyu Lai
6e95d70fae [automerger skipped] Merge changes I92f6d977,I06840834 into qt-dev
am: b05b4d609f -s ours
am skip reason: change_id Ibcb91105e46f7e898b8aa7c2babc3344ef2c6257 with SHA1 0586a60292 is in history

Change-Id: I64a66b8c08963428d409908f93c1d557fd9e4ff6
2019-05-13 03:14:30 -07:00
Junyu Lai
7da0d7f02e Merge "Fix concurrent modification exception in KeepaliveTracker" 2019-05-13 10:09:48 +00:00
junyulai
c602b40237 Limit unprivileged keepalives per uid
Public APIs for creating unprivileged NATT socket keepalive
might allow users to exhaust resource if malicious apps try
to create keepalives with fd which is not created by
IpSecService through binder call. Thus, this change add
customizable limitation per uid to prevent resource exhaustion
attack.

Bug: 129371366
Bug: 132307230
Test: atest FrameworksNetTests

Clean cherry-pick of aosp/954040
Merged-In: Ibcb91105e46f7e898b8aa7c2babc3344ef2c6257
Merged-In: Ia667386c1a8949839871a6949d79552d9c8b88f0

Change-Id: I92f6d977b6dfde4e1bf74df6b60c9a0b9e8eec40
2019-05-13 15:53:02 +09:00
junyulai
ec4eb8f448 Support customization of supported keepalive count per transport
This change specifies the required minimum supported keepalives
in SDK, and allows OEMs to customize supported keepalive count
per network through resource overlay.

Bug: 129371366
Test: 1. m -j doc-comment-check-docs
      2. atest FrameworksNetTests

Clean cherry-pick of aosp/946359

Change-Id: I06840834d0ee8121358bf4829fe47ecf9964d395
Merged-In: I0218f3674628c13ead63fc9a873895ba7f113033
Merged-In: Ia667386c1a8949839871a6949d79552d9c8b88f0
2019-05-13 15:52:07 +09:00
junyulai
6e2c653c6e Fix concurrent modification exception in KeepaliveTracker
In aosp/951200, the clean up function delete the item in the
hash map that holds the record while iterating it, where the
list used to iterate the records is backed by the hash map,
so changes to the map are reflected in the list and caused
the concurrent modification exception.

Bug: 132341736
Test: 1. atest com.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 300
      2. atest FrameworksNetTests --generate-new-metrics 10

Change-Id: I0481a469ee23231e5f0ab738a06b5e09f6cdb680
2019-05-13 14:48:41 +08:00
Paul Hu
16a3411c95 [automerger skipped] Merge "Add CTS API coverage for APIs which are used by NetworkStack" into qt-dev
am: 1140cb3dbb -s ours
am skip reason: change_id Id3f0d1c19a76c7987b69e449203fc50423f5e531 with SHA1 e6a0ed54d3 is in history

Change-Id: I0dc150eb7a4c72f381df12919de8e7ccfb341ba0
2019-05-12 19:46:24 -07:00
TreeHugger Robot
1140cb3dbb Merge "Add CTS API coverage for APIs which are used by NetworkStack" into qt-dev 2019-05-13 02:41:34 +00:00
Paul Hu
36ca94dee1 [automerger skipped] Merge "Add ApfCapabilities common test cases" into qt-dev
am: 4506469d8e -s ours
am skip reason: change_id Icfd80943212430b2a0e6a4b55f53270cbc3d1693 with SHA1 3f11892c07 is in history

Change-Id: I759c399eedf0e111de92b5d4538409b0a14759bb
2019-05-12 19:40:50 -07:00
Paul Hu
807bd09ce0 [automerger skipped] Merge "Add LinkProperties common test cases" into qt-dev
am: 3d8ee7e355 -s ours
am skip reason: change_id I8d36177cbf4f39da602331e091a60a40f6eaea33 with SHA1 612724480f is in history

Change-Id: Icc484c8d0c483e3306a892f2ed0300109d1328e3
2019-05-12 19:36:34 -07:00
TreeHugger Robot
4506469d8e Merge "Add ApfCapabilities common test cases" into qt-dev 2019-05-13 02:28:03 +00:00
Paul Hu
9a5d592793 Add ApfCapabilities common test cases
Bug: 129199900
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases: added tests pass

Change-Id: I737ab11ccd1bf6f92bae4eae21e67d4d6f86a758
Merged-In: Icfd80943212430b2a0e6a4b55f53270cbc3d1693
Merged-In: I737ab11ccd1bf6f92bae4eae21e67d4d6f86a758
(cherry picked from commit ce54fa5cb392c38bfec62b81664fcc25098eb9dc)
2019-05-13 01:19:00 +00:00
Paul Hu
cd36ebcfcd Add LinkProperties common test cases
Bug: 129198747
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases: added tests pass

Change-Id: I03d162ea3c5bc2ccb8f913bbfdf85ebcd194c35a
Merged-In: I8d36177cbf4f39da602331e091a60a40f6eaea33
Merged-In: I03d162ea3c5bc2ccb8f913bbfdf85ebcd194c35a
(cherry picked from commit 385757291c2e822f1338157a2368e319d4048c89)
2019-05-13 01:17:06 +00:00
Paul Hu
3f11892c07 Merge "Add ApfCapabilities common test cases" am: cc8d6dd0bb
am: f8f19beda6

Change-Id: Icfd80943212430b2a0e6a4b55f53270cbc3d1693
2019-05-12 10:26:45 -07:00
Paul Hu
f8f19beda6 Merge "Add ApfCapabilities common test cases"
am: cc8d6dd0bb

Change-Id: Iafcc1bad3e4d5a6bd574231ccf79b0e775617ae2
2019-05-12 10:15:31 -07:00
Paul Hu
cc8d6dd0bb Merge "Add ApfCapabilities common test cases" 2019-05-12 16:57:18 +00:00
Ian Kasprzak
5e44e5fafc [automerger skipped] Merge "Reland: Add FrameworksNetTests dependency on libcgrouprc" am: 6e0c162246 -s ours
am: e3dc775c7f -s ours
am skip reason: change_id I85891485157ed86e069039dfe3092028ff703dd5 with SHA1 ecbcb7fbfc is in history

Change-Id: If9c8aa41c4e96a79b71c88f199a4f3b0483e31cd
2019-05-10 14:26:25 -07:00
Ian Kasprzak
e3dc775c7f [automerger skipped] Merge "Reland: Add FrameworksNetTests dependency on libcgrouprc"
am: 6e0c162246 -s ours
am skip reason: change_id I85891485157ed86e069039dfe3092028ff703dd5 with SHA1 ecbcb7fbfc is in history

Change-Id: Iec27ecd2f0c0636b066fa0fe83c049fff656343f
2019-05-10 13:37:45 -07:00
Ian Kasprzak
6e0c162246 Merge "Reland: Add FrameworksNetTests dependency on libcgrouprc" 2019-05-10 20:08:54 +00:00
Ian Kasprzak
7617ca1b96 Reland: Add FrameworksNetTests dependency on libcgrouprc
Bug: 132435820
Bug: 132437254

Original CL description:
Add FrameworksNetTests dependency on libcgrouprc

The tests are currently broken without this dependency.

Bug: 129902619
Test: atest FrameworksNetTests
Merged-In: I85891485157ed86e069039dfe3092028ff703dd5
Change-Id: I7daf6bdf8a9f8836d17746e1e352f8f75cd34adc
2019-05-10 12:08:44 -07:00
Xiao Ma
992b7f79a7 Merge "Clean up the arguments annotation and verify items on IpMemoryStoreTest." am: 3bee1cdc4e
am: 82a7e510a5

Change-Id: I1db13a48b59d743482436ecf8a20d7f12edd6e1c
2019-05-10 08:45:30 -07:00
Chalard Jean
38836eabec [automerger skipped] Merge "Support strict mode private DNS on VPNs that provide Internet." into qt-dev
am: 5c31d4ff79 -s ours
am skip reason: change_id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA1 2fca7e3cb3 is in history

Change-Id: I83461198c27a7252d5328283ae37cd52f3902863
2019-05-10 08:41:39 -07:00
Xiao Ma
82a7e510a5 Merge "Clean up the arguments annotation and verify items on IpMemoryStoreTest."
am: 3bee1cdc4e

Change-Id: Ifbd359f9fec530076f3216c171120436ed4221a6
2019-05-10 08:33:48 -07:00
Xiao Ma
3bee1cdc4e Merge "Clean up the arguments annotation and verify items on IpMemoryStoreTest." 2019-05-10 15:16:33 +00:00
Aaron Huang
046a044f92 Merge "Send message to add/remove NAT-T keepalive packet filter." am: 29df9e7e8f
am: c72bc8eea1

Change-Id: I7c6bd151cd79309fb5e6869fd83a800e7425581a
2019-05-10 07:30:01 -07:00
Aaron Huang
c72bc8eea1 Merge "Send message to add/remove NAT-T keepalive packet filter."
am: 29df9e7e8f

Change-Id: I3e35d73a38cfbd0a29ad3f1f859b2d6fdb514ff1
2019-05-10 07:19:27 -07:00
Aaron Huang
29df9e7e8f Merge "Send message to add/remove NAT-T keepalive packet filter." 2019-05-10 13:57:11 +00:00
Chalard Jean
9ff61e4948 Support strict mode private DNS on VPNs that provide Internet.
Currently, strict mode private DNS does not work on VPNs because
NetworkMonitor does not validate VPNs. When a VPN connects, it
immediately transitions to ValidatedState, skipping private DNS
hostname resolution.

This change makes NetworkMonitor perform private DNS hostname
resolution and evaluation even on VPNs.

In order to ensure that the system always immediately switches to
the VPN as soon as it connects, remove the unvalidated penalty
for VPN networks. This ensures that the VPN score is always 101
and the VPN always outscores other networks as soon as it
connects. Previously, it would only outscore other networks
when no-op validation completed.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Test: manually ran a VPN with private DNS in strict mode
atest android.net.cts.ConnectivityManagerTest com.android.cts.net.HostsideVpnTests
Change-Id: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
(cherry picked from commit 414b8c8b1ce8ae2ad6ef95c1ffba19062077d3e6)
2019-05-10 13:09:00 +00:00
Chalard Jean
c455822846 Merge "Support strict mode private DNS on VPNs that provide Internet." am: 9db77747a6
am: e3950cf24a

Change-Id: I28cc679def7cdd4dc5187e65f4524c3998ebcafc
2019-05-10 04:33:43 -07:00
Chalard Jean
e3950cf24a Merge "Support strict mode private DNS on VPNs that provide Internet."
am: 9db77747a6

Change-Id: I6522706917731a944483ad3cb9cdbc20447be6c2
2019-05-10 03:58:01 -07:00
Xiao Ma
ac9eef3530 [automerger skipped] Merge "adopt non-blocking method to obtain the IpMemoryStore service." into qt-dev
am: 29510ea4d8 -s ours
am skip reason: change_id I7de4f23370bdf9c9df5e74ed074c794080d93d95 with SHA1 afc8845452 is in history

Change-Id: I82ccab369a264ac6e7629a83d0ed9b1dbca67725
2019-05-10 02:44:47 -07:00
Chalard Jean
9db77747a6 Merge "Support strict mode private DNS on VPNs that provide Internet." 2019-05-10 09:39:17 +00:00
Paul Hu
612724480f Merge "Add LinkProperties common test cases" am: 78415c34f4
am: 5574b26c8e

Change-Id: I8d36177cbf4f39da602331e091a60a40f6eaea33
2019-05-10 02:20:04 -07:00
Junyu Lai
04a972ec05 Merge changes Ibcb91105,I0218f367 am: 6a5c545890
am: 278e66a401

Change-Id: Ia667386c1a8949839871a6949d79552d9c8b88f0
2019-05-10 02:13:34 -07:00