Commit Graph

2266 Commits

Author SHA1 Message Date
Paul Hu
e6d9de3795 Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission" am: b112d8b907
am: c3c237ceab

Change-Id: I1025da29beb53259f57bd9ca5648b32f2847ed4a
2019-05-14 04:17:29 -07:00
Paul Hu
b112d8b907 Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission" 2019-05-14 10:48:48 +00:00
paulhu
d203f7a358 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
53b36ef72a Merge "Clean up the permission control code in framework" am: 2ecbe8b8b1
am: 3c6d05651b

Change-Id: I1af059171c5d80be7abaee636f012f3b55dac2df
2019-05-13 11:32:59 -07:00
Treehugger Robot
2ecbe8b8b1 Merge "Clean up the permission control code in framework" 2019-05-13 18:04:50 +00:00
Junyu Lai
939ad0b125 Merge "Fix concurrent modification exception in KeepaliveTracker" am: 25c06577c9
am: bdf60ad814

Change-Id: I6221bdff630ebef88bfd9d609e31a0f9ede036ad
2019-05-13 03:52:25 -07:00
junyulai
fe67da777b 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
Aaron Huang
1528ecf226 Merge "Send message to add/remove NAT-T keepalive packet filter." am: 44f2e077ad
am: 384e7bfe73

Change-Id: I7c6bd151cd79309fb5e6869fd83a800e7425581a
2019-05-10 07:30:01 -07:00
Aaron Huang
44f2e077ad Merge "Send message to add/remove NAT-T keepalive packet filter." 2019-05-10 13:57:11 +00:00
Chalard Jean
1a26465d92 Merge "Support strict mode private DNS on VPNs that provide Internet." am: faf2bd1a23
am: 19df6b6b6d

Change-Id: I28cc679def7cdd4dc5187e65f4524c3998ebcafc
2019-05-10 04:33:43 -07:00
Chalard Jean
faf2bd1a23 Merge "Support strict mode private DNS on VPNs that provide Internet." 2019-05-10 09:39:17 +00:00
Junyu Lai
8bb3db8837 Merge changes Ibcb91105,I0218f367 am: c797cf56ca
am: 0d58710edf

Change-Id: Ia667386c1a8949839871a6949d79552d9c8b88f0
2019-05-10 02:13:34 -07:00
Junyu Lai
4c266685b3 Merge changes Ibff278a6,If6d537a3 am: 6eaf680338
am: becb2a3e86

Change-Id: Ic51f3b32375378ff74bdd54d1f36569b277fc80f
2019-05-09 23:30:19 -07:00
Junyu Lai
c797cf56ca Merge changes Ibcb91105,I0218f367
* changes:
  Limit unprivileged keepalives per uid
  Support customization of supported keepalive count per transport
2019-05-10 05:47:23 +00:00
Lorenzo Colitti
ac456b2f36 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
2019-05-10 14:30:54 +09:00
Treehugger Robot
6eaf680338 Merge changes Ibff278a6,If6d537a3
* changes:
  Revert "Add NATT keepalive resources and methods into IpSecService"
  Revert "[KA11] Verify fd ownership and allocate resource for NattKeepalive"
2019-05-10 01:42:26 +00:00
Junyu Lai
9bb90ad13e Merge "Clean up the keepalive slots when network disconnect" am: d3f8253db4
am: 015f800edf

Change-Id: Id3e4e159713c0ed7e03f45169e87b73ae6408e4f
2019-05-09 13:24:32 -07:00
Junyu Lai
d3f8253db4 Merge "Clean up the keepalive slots when network disconnect" 2019-05-09 18:53:03 +00:00
junyulai
a83c9f38a6 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: Ia30741f71fa72fc117e071976fd73991fa3c9535
2019-05-09 17:16:17 +00:00
junyulai
1f8bf657bb 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
Change-Id: Ibcb91105e46f7e898b8aa7c2babc3344ef2c6257
2019-05-10 00:36:58 +08:00
junyulai
15e26fb485 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

Change-Id: I0218f3674628c13ead63fc9a873895ba7f113033
2019-05-10 00:36:58 +08:00
Junyu Lai
5218015ed8 Revert "[KA11] Verify fd ownership and allocate resource for NattKeepalive"
This reverts commit 8368fe9fe0.

Reason for revert: Adds dependency between IpSecService and
                   ConnectivityService may lead to future deadlock
                   problems. Uses a simpler approach instead,
                   hence the solution is not needed.
                   See aosp/954040.

Change-Id: If6d537a39595cf132d3ed81d4eaac6700f5f0ab3
2019-05-08 11:44:20 +08:00
Chenbo Feng
cdd3087296 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
2019-05-07 13:50:25 -07:00
Aaron Huang
a8bce09037 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

Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230
2019-05-06 19:52:48 +08:00
Mark Chien
e252f0fdfc Merge "Add AIDL parcelable for NattKeepalivePacketData" am: 60f78b096f
am: e29c661e04

Change-Id: Iae8d866230dfd8aa2de1b69891d8494812886aac
2019-04-29 04:00:13 -07:00
Mark Chien
60f78b096f Merge "Add AIDL parcelable for NattKeepalivePacketData" 2019-04-29 10:26:35 +00:00
Lorenzo Colitti
8df0f85e86 Merge "Make DNS cache lifecycle management explicit" am: 8970adbc8c
am: af5b4ab4b1

Change-Id: I51cf1b7cfd49d4731d922578e8512a1326ebec63
2019-04-25 17:50:05 -07:00
Lorenzo Colitti
8970adbc8c Merge "Make DNS cache lifecycle management explicit" 2019-04-26 00:23:22 +00:00
Chiachang Wang
052acc4776 Merge "Update exception type thrown when NetworkStack is missing" am: 18aa9b67ea
am: a7e9b83638

Change-Id: I67005a5384888e8acaf1249af79484e2d5ed6f1f
2019-04-24 21:31:21 -07:00
Chiachang Wang
18aa9b67ea Merge "Update exception type thrown when NetworkStack is missing" 2019-04-25 03:48:52 +00:00
Chiachang Wang
619a8a2b08 Update exception type thrown when NetworkStack is missing
rethrowFromSystemServer is throwing DeadSystemException which
is different from the original log message. Thus, update the
way to rethrow the same RemoteException.

Bug: 130028724
Test: atest FrameworksNetTest
Test: Kill NetworkStack and check the log message
Change-Id: I60862e276dd4e2d143278b272a9ba54219acce26
2019-04-24 13:59:50 +00:00
Aaron Huang
15400f216d Add AIDL parcelable for NattKeepalivePacketData
Bug: 33530442
Test: atest FrameworksNetTests

Change-Id: I9b9a51dc5dc06c90229fb36c34c24258991c4146
2019-04-24 16:19:54 +08:00
Aaron Huang
1465573044 Merge "Move NattKeepalivePacketData out of the framework" am: 7640cb0157
am: 7abf8c5880

Change-Id: Idf7c25b6b553d8c0cc4ef2ea8193438480420fb4
2019-04-23 21:26:03 -07:00
Aaron Huang
7640cb0157 Merge "Move NattKeepalivePacketData out of the framework" 2019-04-24 04:00:56 +00:00
Lorenzo Colitti
0498b5aa98 Merge "Freeze the networkstack-aidl-interfaces interface" am: a746ac5036
am: adea8d6da1

Change-Id: I0bc827a6c7995eb7b50b4afeed11317ad8e29666
2019-04-23 01:55:01 -07:00
Lorenzo Colitti
a746ac5036 Merge "Freeze the networkstack-aidl-interfaces interface" 2019-04-23 08:33:41 +00:00
Junyu Lai
74da4671c4 Merge "[KA11] Verify fd ownership and allocate resource for NattKeepalive" am: 123eb11c48
am: c47cd94455

Change-Id: I410acc19ceb13e32c65cbdf3095da9db0802470c
2019-04-23 01:18:54 -07:00
Remi NGUYEN VAN
e72fe2bc46 Freeze the networkstack-aidl-interfaces interface
This freezes the interface as of the latest beta build, not the tip of
tree. IIpClient#setL2KeyAndGroupHint is not in the frozen definition in
particular.

Generated with:
m networkstack-aidl-interfaces-freeze-api \
    ipmemorystore-aidl-interfaces-freeze-api

Test: flashed, booted, WiFi and captive portal working
Bug: 128803828
Change-Id: Ideabe73fc93bbefca2d624ee9ca190cf31419424
2019-04-23 06:49:58 +00:00
junyulai
8368fe9fe0 [KA11] Verify fd ownership and allocate resource for NattKeepalive
Since socket keepalive APIs for UDP encapsulation sockets are
public to generic app. In order to ensure the given fd is valid,
this change verifies the resource id inside the UDP
encapsulation socket by using methods provided by IpSecService.

Bug: 125517194
Fix: 123968920
Test: 1. atest FrameworksNetTests --generate-new-metrics 10
      2. atestcom.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 100
Change-Id: I408aacc19b364683854d15a095c34e72389a6e5b
2019-04-23 10:47:19 +08:00
Chalard Jean
fe8c062223 Merge "Fix an argument to the legacy broadcast" am: 5036127856
am: 182fe69f50

Change-Id: I0fc408d546ae9d72b7dd9415e502252b484d4329
2019-04-22 18:12:27 -07:00
Chalard Jean
5036127856 Merge "Fix an argument to the legacy broadcast" 2019-04-23 00:38:10 +00:00
Benedict Wong
886fff3866 Merge "Add configurability of LinkProperties, meteredness for Test Networks" am: c704b9fd07
am: b19bf0b92d

Change-Id: I9c8220efd56f72aabae028b48ac2f88ec7b8f659
2019-04-22 11:18:52 -07:00
Benedict Wong
c704b9fd07 Merge "Add configurability of LinkProperties, meteredness for Test Networks" 2019-04-22 17:41:20 +00:00
Chalard Jean
24a433a538 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
135c5261ec 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
bc6e9e7478 Merge "Make LegacyTypeTracker testable" am: 54cedaca89
am: 8bacdf6e64

Change-Id: I53457ad6af430c551c6909a7e68127a3667efde9
2019-04-21 17:25:03 -07:00
Benedict Wong
b6ebb67782 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
41014aa609 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
Chalard Jean
8cc4e876cd 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
7f38159e5b Merge "Backwards-incompatible resolv module API change for making setResolverConfiguration take a parcelable." am: df39b855b5
am: 8307a9a249

Change-Id: I6dc9029af0df0d3b391210bd315516bdf1b5e4c9
2019-04-17 07:26:59 -07:00