Commit Graph

6148 Commits

Author SHA1 Message Date
Lorenzo Colitti
f7e1739d9b Track NAT64 in the framework and start clatd iff NAT64 detected
Currently, both netd and clatd do NAT64 prefix detection, and we
start clatd on all IPv6-only networks regardless of whether netd
has detected a NAT64 prefix or not.

Instead, track the NAT64 prefix in the framework, and only start
clatd if the prefix is detected. This will allow us to remove
DNS64 detection in clatd, and pass the NAT64 prefix and the IPv6
address to clatd on the command line instead of clatd finding it
itself. That way, netd and the framework will always know how
464xlat is configured, and we'll be able to use that information
in netd.

Test: builds, boots
Test: atest FrameworksNetTests
Change-Id: Ida32d5760c5aecf7aeebef08fdb596291b2ce14a
2019-02-25 11:42:00 +09:00
Lorenzo Colitti
7b0732fff7 Change Nat464Xlat lifecycle.
Currently, NetworkAgentInfo keeps a Nat464Xlat object only on
networks where we're starting clatd (i.e., IPv6-only networks).
Simplify this code by making the Nat464Xlat object final and
always non-null. This allows us to use Nat464Xlat to store
information, such as the NAT64 prefix, even if the clat daemon
has not been started yet.

Also, remove the STOPPING state which waits for the interface to
be removed. Instead, when stop() is called, immediately enter the
IDLE state.
- This is necessary in order to be able to call start() again
  before the interface removal notification has arrived.
- It's also arguably more correct than the current code,
  because when stop() returns clatd has already terminated
  (ClatdController::stopClatd calls waitpid), and thus the tun
  fd is already closed and the tun interface is gone.

Also, now that Nat464Xlat objects are reused after stop(), add
test coverage for calling start() after stop, in both cases:
- The notification that the previous interface was removed
  arrives before the second start().
- The notification that the previous interface was removed
  arrives after the second start() but before the notification
  that the second interface was added.

Also fix a couple of lint warnings.

Test: builds, boots
Test: atest FrameworksNetTests
Test: clatd stops when IPv4 address added
Test: clatd restarts after "adb shell killall clatd"
Change-Id: I3dc66d155aa27606681f3473daf2170434d8c6d0
2019-02-25 11:42:00 +09:00
Lorenzo Colitti
c11592ce7c Minor improvements to verifyTcpBufferSizeChange.
1. Remove "throws Exception" from the signature so it can be used
   in tests that do not already throw Exception.
2. Update comment to reflect the fact that TCP buffer sizes are
   set on default network switch, not on connect.
3. Move into the method a class-level static constant that is
   only used in that method.

Test: atest ConnectivityServiceTest
Change-Id: Ic2e4fbedc23065efc20e45ea84996b577a8e94b6
2019-02-25 11:41:50 +09:00
Xin Li
9528e63d19 Merge "DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master" into stage-aosp-master 2019-02-23 00:39:16 +00:00
markchien
822935397c Return not supported if no necessary socket option
In order to support tcp keepalive offload, some socket
options are necessary. If one of them isn't supported in
kernel, just return ERROR_HARDWARE_UNSUPPORTED to the
caller.
e.g.
TCP_REPAIR starts from kernel 3.5
TCP_REPAIR_QUEUE starts from kernel 3.5
TCP_QUEUE_SEQ starts from kernel 3.5
TCP_REPAIR_WINDOW starts from kernel version 4.8

Bug: 124453402
Test: -boot, flash, atest FrameworksNetTests
      -start tcp keepalive offload in kernel 4.4 and 4.9 device.

Change-Id: I6f87e5be2f2ca7aae1293820c164d0bc7b664eb6
2019-02-22 06:12:14 +00:00
Xin Li
596142b8d9 DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master
Bug: 120848293
Change-Id: I2f9a524f2ba552de3f62e343075cf0abf400bbae
2019-02-21 16:02:06 -08:00
Remi NGUYEN VAN
f39152e999 Merge "Add logging to NetworkStackClient"
am: edb26a53d3

Change-Id: I0fe820c6feab3caa9ad0739df100553b2d4374e0
2019-02-21 14:28:46 -08:00
Remi NGUYEN VAN
edb26a53d3 Merge "Add logging to NetworkStackClient" 2019-02-21 22:13:31 +00:00
Chenbo Feng
4930ac3fea Merge "Send special permission information to netd"
am: c60e99de22

Change-Id: I35aa015a9448b5f8563da0aee40afd3101df29ff
2019-02-21 13:30:32 -08:00
Treehugger Robot
c60e99de22 Merge "Send special permission information to netd" 2019-02-21 20:27:58 +00:00
Remi NGUYEN VAN
31c44d7bc4 Add logging to NetworkStackClient
The current logging relies on the system log that may rotate. This is a
problem to investigate bugs where the network stack service is not
started. Add a SharedLog to NetworkStackClient and dump it in
ConnectivityService (for lack of a better place to dump it).

Bug: 124307802
Test: Booted, dumpsys connectivity shows the log
Change-Id: If596451d0613645f68a8a32acb032eea76ea506c
2019-02-21 17:09:12 +09:00
Chenbo Feng
92c4d5e649 Send special permission information to netd
Netd need the list of apps that have permission INTERNET or permission
UPDATE_DEVICE_STATS at run time to make decisions about application
request. To avoid protential deadlock and reduce the traffic between
netd and system server, Use packageManagerServcie to send the list of
apps that have those permissions to netd when device boot and when new
apps get installed.

Bug: 111560570
Bug: 111560739
Test: install and uninstall packages and dumpsys netd trafficcontroller
Change-Id: Idb9905f424557a5c59e35d41f5eafe345aca87e0
2019-02-20 14:07:18 -08:00
Varun Anand
bfabfe0ab3 Update VPN capabilities when its underlying network set is null.
Previously, they were only updated when underlying network set was
non-null.

This change also ensures that all the calls b/w ConnectivityService and
Vpn that leads to updating capabilities are on ConnectivityService
handler thread.

Additionally, it also ensures that capabilities are propagated after VPN
enters connected state.

This change also updates VPN capabilities inline from
ConnectivityService handler thread. Previously, there was an additional
loop where Vpn would update capabilities via NetworkAgent thru
AsyncChannel which posts back to CS handler thread, which could
potentially lead to delays in updating VPN capabilities.

Bug: 119129310
Bug: 118856062
Bug: 124268198
Test: atest FrameworksNetTests
Test: manual - verified VPNs capabilities are getting updated and
DownloadManager is working correctly.

(cherry picked from commit 4fa80e8a2f03557221e0371a987e780df7788faa)

Change-Id: Iae5f2024b19df04c31938815b52687781d016cde
Merged-In: Id0abc4d304bb096e92479a118168690ccce634ed
2019-02-20 18:37:44 +00:00
Xin Li
a9588c6ea9 [automerger skipped] Merge changes from topic "PPRL.190205.001"
am: 6e7600f32f -s ours
am skip reason: change_id I421c7487955ee339f88e3957c973375d0f87e2ff with SHA1 95bd7221f6 is in history

Change-Id: Ieb824b633f240abc96ee25f39c68f55f1bd621bd
2019-02-20 10:17:48 -08:00
Xin Li
6e7600f32f Merge changes from topic "PPRL.190205.001"
* changes:
  Fix merge problems with cherry-picking "Add notification settings to backup&restore" change into pi-dev
  DO NOT MERGE - Merge PPRL.190205.001 into master
2019-02-20 16:25:58 +00:00
Rubin Xu
fab8b096c3 Merge "Skip unreachable route when estimating VPN destinations"
am: e26fb9d574

Change-Id: Iafa9ecaf07a36f235b366655d2fa2165a676d1cd
2019-02-20 04:15:55 -08:00
Treehugger Robot
e26fb9d574 Merge "Skip unreachable route when estimating VPN destinations" 2019-02-20 12:00:15 +00:00
Rubin Xu
8b1352fdaa Skip unreachable route when estimating VPN destinations
Bug: 122652441
Test: atest com.android.server.connectivity.VpnTest
Test: Establish a IPv4 VPN with minimal routes and check
(dumpsys connectivity) the VPN network does not have INTERNET
capability.

Change-Id: Ic7f19ebb7b7f78a6ffb2a8ec3fc3eca5e5421f57
2019-02-19 17:18:34 +00:00
Varun Anand
07fff8eb3c Merge "Update VPN capabilities when its underlying network set is null."
am: c7702baa80

Change-Id: Id4560d201a40f5e1b1617819991da99d86379dbe
2019-02-15 03:45:03 -08:00
Treehugger Robot
c7702baa80 Merge "Update VPN capabilities when its underlying network set is null." 2019-02-15 11:33:27 +00:00
Remi NGUYEN VAN
ef77a4a341 Merge "Move NetworkStack to services.net"
am: 4616612b6b

Change-Id: Iab45985aedb8069ad50fd2913ef6e828989cdd0d
2019-02-15 03:01:11 -08:00
Remi NGUYEN VAN
4616612b6b Merge "Move NetworkStack to services.net" 2019-02-15 10:52:03 +00:00
Remi NGUYEN VAN
48eaae51e3 Merge "Remove NetworkMonitor dependency on ICaptivePortal"
am: 399be8f9b9

Change-Id: Ia0d06e1aa931cdc1c6dd4008e804a6a44ae2304f
2019-02-15 00:26:34 -08:00
Remi NGUYEN VAN
399be8f9b9 Merge "Remove NetworkMonitor dependency on ICaptivePortal" 2019-02-15 08:09:29 +00:00
Remi NGUYEN VAN
ef59a21ff4 Move NetworkStack to services.net
NetworkStack is only used in services.net or clients of services.net. It
cannot stay in framework.jar because it needs to depend on AIDL
interfaces, which would conflict with app implementations if they were
in framework.jar.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 124033493
Change-Id: Ib1d08a3669983640119d008db7e2990fa798724f
Merged-In: I501b125a388c1100c2182bde4670944c2f0d7a02
2019-02-15 12:20:17 +09:00
Remi NGUYEN VAN
eab0f54735 Remove NetworkMonitor dependency on ICaptivePortal
ICaptivePortal is used in the framework and cannot be used as a
dependency in NetworkMonitor, as the framework class takes precedence
when linking.
Also fix NetworkMonitorTest that was not verifying the right
startCaptivePortalApp call.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 124033493
Change-Id: I8e7bb79e50650ae182a2e4277fb49abf5fb6d910
Merged-In: Ib6a89e54312628662b130fbeec18d11e139f09fa
2019-02-15 12:20:03 +09:00
Varun Anand
df56995870 Update VPN capabilities when its underlying network set is null.
Previously, they were only updated when underlying network set was
non-null.

This change also ensures that all the calls b/w ConnectivityService and
Vpn that leads to updating capabilities are on ConnectivityService
handler thread.

Additionally, it also ensures that capabilities are propagated after VPN
enters connected state. This was previously done from establish which
could potentially lead to race between VPN getting connected and
capabilities getting updated.

This change also updates VPN capabilities inline from
ConnectivityService handler thread. Previously, there was an additional
loop where Vpn would update capabilities via NetworkAgent thru
AsyncChannel which posts back to CS handler thread, which could
potentially lead to delays in updating VPN capabilities.

Bug: 119129310
Bug: 118856062
Bug: 124268198
Test: atest FrameworksNetTests
Test: manual - verified VPNs capabilities are getting updated and
DownloadManager is working correctly.

Change-Id: Id0abc4d304bb096e92479a118168690ccce634ed
2019-02-14 18:50:56 -08:00
Xin Li
4198f09aa7 Merge "DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into stage-aosp-master" into stage-aosp-master 2019-02-14 22:11:32 +00:00
Benedict Wong
9dd06ba6a9 Merge "Add Test Network and Transport types"
am: 9a5d3ba1ad

Change-Id: I1cf33485adb9f4c442de42060697efe71bb45264
2019-02-14 10:49:48 -08:00
Benedict Wong
9a5d3ba1ad Merge "Add Test Network and Transport types" 2019-02-14 18:37:04 +00:00
Xin Li
472cc5b849 DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into
stage-aosp-master

Bug: 124234733
Change-Id: Ic4f67fde0835da0b1c363906cccef0d244e38393
2019-02-14 09:48:06 -08:00
Remi NGUYEN VAN
ec2b289d42 Merge "Fix flaky testNattSocketKeepalives"
am: 9a9e288607

Change-Id: Ie9fe40e3bcf4187a2e5cbf525bc4e874cff70747
2019-02-13 20:42:01 -08:00
Lucas Lin
da969f4f40 Merge "Clear all lingering notifications when network is disconnected"
am: 1037bbb82a

Change-Id: I2d9f84840cdc73ed3b30278d7a9dbeefff233fa3
2019-02-13 20:29:03 -08:00
Remi NGUYEN VAN
9a9e288607 Merge "Fix flaky testNattSocketKeepalives" 2019-02-14 03:29:00 +00:00
Remi NGUYEN VAN
b76f9ee4e6 Fix flaky testNattSocketKeepalives
The test did not wait for the WifiNetworkAgent to disconnect, and there
are reports of flakes where it is still connected in
connectKeepaliveNetwork.

Test: atest FrameworksNetTests
Bug: 124319553
Change-Id: I85968806885c8853ec4f4dbea356366c1af0ea1c
2019-02-14 03:28:48 +00:00
lucaslin
b25c9a6cb3 Clear all lingering notifications when network is disconnected
In aosp/861571, it tried to refine the design to prevent the
lingering notification is cleared unexpectedly. However, all
notifications should be cleared when network is disconnected.
Refine the design by clearing all lingering notifications when
network is disconnected.

Bug: 123488640
Bug: 123537643
Test: 1.Build pass
      2.atest FrameworksNetTests
      3.Connect to a hotspot which doesn't have internet,
      after getting "NO_INTERNET" notification, disconnect
      the wifi and check if "NO_INTERNET" notification will
      be cleared or not.
Change-Id: Iac45ec186cf81915c318dba37f43136609d579f6
2019-02-13 03:23:10 +00:00
Remi NGUYEN VAN
e6fbb4664f Merge "Remove hard-coded NetworkStack package name"
am: 694dd4a5e2

Change-Id: I0e67a5e857d4f5ba2af1f0928be6d97c0f4ce94f
2019-02-11 20:22:40 -08:00
Remi NGUYEN VAN
694dd4a5e2 Merge "Remove hard-coded NetworkStack package name" 2019-02-12 03:58:09 +00:00
Benedict Wong
bdfaa48ced Add Test Network and Transport types
This change adds new network types for testing purposes, signifying a
network with an extremely limited feature set.

Bug: 72950854
Test: Compiles, CTS tests relying on this work correctly.
Change-Id: I06cade6044afd12e0b69ed3c2f160f27f85d43d0
2019-02-11 12:57:43 -08:00
android-build-team Robot
79cdc783ee Snap for 5180536 from 1151e49dce to pi-platform-release
Change-Id: I7c5a9c9e96572c32eadd97448c4886f9c9150a19
2019-02-09 02:33:11 +00:00
Remi NGUYEN VAN
794c7f2ee3 Remove hard-coded NetworkStack package name
Have the network stack pass its package name in
showProvisioningNotification instead.

Bug: 124033493
Test: flashed, WiFi and captive portal works
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1f3312768ba1fb34e99a827e1fcdaf7510e318a8
2019-02-08 12:12:57 +09:00
Remi NGUYEN VAN
9da4305183 Merge "Check MAINLINE_NETWORK_STACK in ConnectivityService"
am: 2f96229cbd

Change-Id: I5bc7a8dae5667a1509f9741be571008a919b6461
2019-02-06 19:50:15 -08:00
Remi NGUYEN VAN
2f96229cbd Merge "Check MAINLINE_NETWORK_STACK in ConnectivityService" 2019-02-07 03:33:54 +00:00
Remi NGUYEN VAN
640909fadf Merge "Add API for NetworkStack to start captive portal"
am: 9d0e114e66

Change-Id: I72166f14ec4f7589a1dbd0334de37530ebccf88e
2019-02-06 18:49:45 -08:00
Remi NGUYEN VAN
9d0e114e66 Merge "Add API for NetworkStack to start captive portal" 2019-02-07 02:39:17 +00:00
Chalard Jean
f924dfe504 Merge "[KA04] Expose TCP socket keepalive API"
am: b099846c86

Change-Id: If8bc33ff30a529092802f9450a3772aaaa401c20
2019-02-06 07:22:31 -08:00
Chalard Jean
b099846c86 Merge "[KA04] Expose TCP socket keepalive API" 2019-02-06 15:13:02 +00:00
junyulai
0835a1eaea [KA04] Expose TCP socket keepalive API
The new set of API allows applications to request keepalives
offload for established TCP sockets over wifi.

However, the application must not write to or read from the
socket after calling this method, until specific callbacks are
called.

Bug: 114151147
Test: atest FrameworksNetTests FrameworksWifiTests NetworkStackTests

Change-Id: I3880505dbc35fefa34ef6c79555458ecf5d296a4
2019-02-06 22:51:42 +09:00
Chalard Jean
90cad47708 Merge "[KA03.5] Add stable AIDL parcelable for TcpKeepalivePacketData"
am: 6e55aca3fa

Change-Id: I3ee97cd66e19486ba0edd6cab58bd37b43a0904b
2019-02-06 01:29:24 -08:00
Chalard Jean
6e55aca3fa Merge "[KA03.5] Add stable AIDL parcelable for TcpKeepalivePacketData" 2019-02-06 09:19:07 +00:00