Commit Graph

6334 Commits

Author SHA1 Message Date
Lorenzo Colitti
cdd4722829 Catch ServiceSpecificException instead of IllegalStateException.
The old NetworkManagementService methods to start clatd threw
IllegalStateException, but the new netd methods throw
ServiceSpecificException. Update the catch clauses so that if
starting clatd fails, the system doesn't crash.

Also stop logging stack traces but only include the exception
message itself.

Bug: 65674744
Test: atest FrameworksNetTests
Test: connecting/disconnecting to v6-only wifi in a loop does not crash
Change-Id: I4a9ec7f104712fbbe08f4f67e3288df03e8ed873
2019-02-27 18:21:22 +09:00
Chiachang Wang
3b723c2ee8 Fix broken javadoc links
Bug: 123683994
Test: Verify with javadoc
Change-Id: I4b1b936e3cf86104ace5fcb6829778710801f2d5
2019-02-27 17:18:40 +08:00
Lorenzo Colitti
84298d8e5e Manage NAT64 prefix discovery lifecycle in the framework.
Currently NAT64 prefix discovery, which runs in netd, is started
by netd itself when a network is programmed with all-IPv6 DNS
servers. Unfortunately this is not correct because in many cases
we program DNS servers before the network is connected and it's
actually possible to send packets to them.

In general netd does not have enough visibility into network
lifecycle management to decide when to start and stop prefix
discovery. So move it into the framework with the rest of the
464xlat control plane.

Bug: 65674744
Test: atest FrameworksNetTests
Change-Id: I8fa051a9c216d9c05082bf7d0bbb0cbd56000162
2019-02-27 00:18:13 +09:00
Xin Li
7d45a8fd6f [automerger skipped] Merge "DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master" into stage-aosp-master am: 9528e63d19 -s ours
am: 1a28cbbca0 -s ours
am skip reason: subject contains skip directive

Change-Id: Id92cda80ee1afb5ebef1815480e14c4c674752fc
2019-02-25 19:17:12 -08:00
Xin Li
1a28cbbca0 [automerger skipped] Merge "DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master" into stage-aosp-master
am: 9528e63d19 -s ours
am skip reason: subject contains skip directive

Change-Id: Ia5bdfa13266268f317d62fc56dfbb3501efb50ff
2019-02-25 18:42:07 -08:00
Xin Li
9d5a62aecc [automerger skipped] DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master am: 596142b8d9 -s ours
am: d9c53bc84e -s ours
am skip reason: subject contains skip directive

Change-Id: I2b3cf7ba11fc80010badbb212902a5507d5caae0
2019-02-25 17:16:05 -08:00
Xin Li
d9c53bc84e [automerger skipped] DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master
am: 596142b8d9 -s ours
am skip reason: subject contains skip directive

Change-Id: I6c115125bad894bbb597557f2e9c3de3eb2b95b5
2019-02-25 16:13:06 -08:00
Remi NGUYEN VAN
b231578e0a Merge "Add logging to NetworkStackClient" am: edb26a53d3 am: f39152e999
am: 5204b5a8cf

Change-Id: I7241888c779e8f47161dc2f555e140555134434c
2019-02-25 10:32:55 -08:00
Chenbo Feng
8ea70f229b Merge "Send special permission information to netd" am: c60e99de22 am: 4930ac3fea
am: f63d61a24a

Change-Id: Icb1fa5d980f74902fd085580a7534a5ad7cd00a0
2019-02-25 10:26:51 -08:00
Remi NGUYEN VAN
5204b5a8cf Merge "Add logging to NetworkStackClient" am: edb26a53d3
am: f39152e999

Change-Id: Ib2f6bcda2429346d0418b460bc040fc5e9edbe97
2019-02-25 09:14:44 -08:00
Chenbo Feng
f63d61a24a Merge "Send special permission information to netd" am: c60e99de22
am: 4930ac3fea

Change-Id: I80271fa7c4e1c6a8e2eea55adf12abaece64d8da
2019-02-25 09:10:05 -08:00
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
Etan Cohen
bd51b3057a Merge "[CS] Support "instant failure" from factories" 2019-02-22 14:29:39 +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
377615d6b0 [automerger skipped] Merge "Update VPN capabilities when its underlying network set is null." into pi-dev am: b4b64ad602 -s ours
am: ee4db00d45 -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: Icab5d7a43a26be9a4c2d01279453571062b2a808
2019-02-20 12:36:39 -08:00
Varun Anand
ee4db00d45 [automerger skipped] Merge "Update VPN capabilities when its underlying network set is null." into pi-dev
am: b4b64ad602 -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: I8cdd422bf5686c707d60137eccb4e1caae8194a3
2019-02-20 12:14:20 -08:00
Xin Li
874fd7b049 [automerger skipped] Merge changes from topic "PPRL.190205.001" am: 6e7600f32f -s ours am: a9588c6ea9 -s ours
am: c6a489ba2c -s ours
am skip reason: change_id I421c7487955ee339f88e3957c973375d0f87e2ff with SHA1 afc94d724c is in history

Change-Id: I9d0dd19c248b350d12233c4d9a71a30659021388
2019-02-20 11:26:07 -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
c6a489ba2c [automerger skipped] Merge changes from topic "PPRL.190205.001" am: 6e7600f32f -s ours
am: a9588c6ea9 -s ours
am skip reason: change_id I421c7487955ee339f88e3957c973375d0f87e2ff with SHA1 95bd7221f6 is in history

Change-Id: If0a545f1a09f0a4471f2c6adadfe79ad434bebd4
2019-02-20 10:36:50 -08: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
e70e6ddd39 Merge "Skip unreachable route when estimating VPN destinations" am: e26fb9d574 am: fab8b096c3
am: dcdc2174af

Change-Id: Id81038035eddf98d0c4546ddb25c8f6ed5736ad6
2019-02-20 04:35:38 -08:00
Rubin Xu
dcdc2174af Merge "Skip unreachable route when estimating VPN destinations" am: e26fb9d574
am: fab8b096c3

Change-Id: Ia9301b3bf52b42a742f1f6b3a02499a1404ed3f1
2019-02-20 04:26:25 -08: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
bbefd325bc Merge "Update VPN capabilities when its underlying network set is null." am: c7702baa80 am: 07fff8eb3c
am: 30714647b4

Change-Id: I6dd5a369f1a3b74bbf498051ef1e4d1b31bd8e5e
2019-02-15 04:11:55 -08:00
Varun Anand
30714647b4 Merge "Update VPN capabilities when its underlying network set is null." am: c7702baa80
am: 07fff8eb3c

Change-Id: I832cbc4646c010add5a4f051d3f7151cfc94120c
2019-02-15 03:54:28 -08: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
bec1549e0d [automerger skipped] Merge "Move NetworkStack to services.net" am: 4616612b6b am: ef77a4a341
am: 4eac707c0a -s ours
am skip reason: change_id I501b125a388c1100c2182bde4670944c2f0d7a02 with SHA1 b6997cc4da is in history

Change-Id: Iba45b354c8a6b690177a1bc9928ea87a5850515c
2019-02-15 03:19:33 -08:00
Remi NGUYEN VAN
4eac707c0a Merge "Move NetworkStack to services.net" am: 4616612b6b
am: ef77a4a341

Change-Id: I6a0ddc23bf95039d9d51a4fde9dd87d2f5bf71ee
2019-02-15 03:10:18 -08: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
f39c5b5e07 [automerger skipped] Merge "Remove NetworkMonitor dependency on ICaptivePortal" am: 399be8f9b9 am: 48eaae51e3
am: b7bcb16007 -s ours
am skip reason: change_id Ib6a89e54312628662b130fbeec18d11e139f09fa with SHA1 ad9f6d89f6 is in history

Change-Id: Id24f7fd07472e541d109c6fd08be78bdc2c2bf6a
2019-02-15 00:43:22 -08:00
Remi NGUYEN VAN
b7bcb16007 Merge "Remove NetworkMonitor dependency on ICaptivePortal" am: 399be8f9b9
am: 48eaae51e3

Change-Id: I60c67a42bce60615f7e0ce86aaafac4fbff19795
2019-02-15 00:34:13 -08: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
14aff42bdf Merge "Move NetworkStack to services.net" 2019-02-15 07:25:09 +00:00
Xin Li
829f39dccf [automerger skipped] Merge "DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into stage-aosp-master" into stage-aosp-master am: 4198f09aa7 -s ours
am: 63aeccfcd6 -s ours
am skip reason: subject contains skip directive

Change-Id: Ib0b6f1151f8552b8a78ab6263fc5f4676444b37c
2019-02-14 21:46:01 -08:00