Commit Graph

5786 Commits

Author SHA1 Message Date
Mark Chien
f641f82feb Merge "Return not supported if no necessary socket option" am: 719b872bfe
am: 857c29a147

Change-Id: I58b49eab495b6b949368f86f5dd32bfc507d4141
2019-03-04 01:37:26 -08:00
Mark Chien
857c29a147 Merge "Return not supported if no necessary socket option"
am: 719b872bfe

Change-Id: I592d08040459e544a53861b4e8a0ee49a50f225b
2019-03-04 01:28:12 -08:00
Mark Chien
719b872bfe Merge "Return not supported if no necessary socket option" 2019-03-04 09:16:07 +00:00
Jack Yu
93991029c5 Merge "Fixed all APIs not meeting API review requirement" am: a4c326157c
am: 48ed523a6d

Change-Id: I4fceb789ebcfff76cc0205889e9c5084c83d4471
2019-03-02 20:50:08 -08:00
Jack Yu
48ed523a6d Merge "Fixed all APIs not meeting API review requirement"
am: a4c326157c

Change-Id: I84c1b55e99bf89c818c365f4954d9e3921904636
2019-03-02 20:40:56 -08:00
Treehugger Robot
a4c326157c Merge "Fixed all APIs not meeting API review requirement" 2019-03-03 04:27:32 +00:00
Lorenzo Colitti
7587fe6683 Merge "Ensure handleUpdateLinkProperties runs on the CS handler thread." am: bfe05b0388
am: e8e44c0a75

Change-Id: I14555061639da3b04b4bca74c692ac94e5713c74
2019-03-01 22:06:58 -08:00
Lorenzo Colitti
e8e44c0a75 Merge "Ensure handleUpdateLinkProperties runs on the CS handler thread."
am: bfe05b0388

Change-Id: I46e448611a23a9e75f05b0ab48d4af47175de6d4
2019-03-01 21:58:39 -08:00
Treehugger Robot
bfe05b0388 Merge "Ensure handleUpdateLinkProperties runs on the CS handler thread." 2019-03-02 05:38:21 +00:00
Jeff Vander Stoep
0b9ba97454 Merge "getConnectionOwnerUid: Clarify documentation" am: 1a4ffd5df1
am: 579402391a

Change-Id: I6897d552ed0a3f6ab6ac3616193fc4442cadc05a
2019-03-01 20:10:48 -08:00
Jeff Vander Stoep
579402391a Merge "getConnectionOwnerUid: Clarify documentation"
am: 1a4ffd5df1

Change-Id: I6d469968754a355871655f0a29c75e7305874bc3
2019-03-01 19:56:05 -08:00
Treehugger Robot
1a4ffd5df1 Merge "getConnectionOwnerUid: Clarify documentation" 2019-03-02 03:42:22 +00:00
Paul Duffin
e137413db2 Merge "Fix Automated API Review: InetAddresses" am: 4daca39083
am: 1c0dc70654

Change-Id: Ibcef646f539b1a871d8521d7216ecb6f7df8c0fd
2019-03-01 19:25:24 -08:00
Paul Duffin
1c0dc70654 Merge "Fix Automated API Review: InetAddresses"
am: 4daca39083

Change-Id: I0125d756d2026656afca9e29b7963c0e724750ac
2019-03-01 19:15:54 -08:00
Jack Yu
3ee7ba172e Fixed all APIs not meeting API review requirement
To address the API review feedback provided by
the API council.

Bug: 126702995
Bug: 126701710
Bug: 126702357
Bug: 126701113
Bug: 126701239
Bug: 126700713
Bug: 126700064
Test: Manual
Change-Id: I4b902c1fc2c09133022b05dacdda8964436205d2
2019-03-01 14:37:47 -08:00
Paul Duffin
3b6665ecac Fix Automated API Review: InetAddresses
Add @NonNull annotations as required by the automated review.

Bug: 126702338
Test: make checkbuild
Change-Id: I9057f06de8d7ea846af00d5cefa744d4206b4b63
2019-03-01 14:06:18 +00:00
Varun Anand
cec5c73d8f Merge "Remove ConnectivityManager and its usages from NetworkStatsService." am: 93dfa10da4
am: 014fc924bc

Change-Id: Ieb10b88344dd4436913426961e6999577a469f36
2019-02-28 19:25:53 -08:00
Varun Anand
014fc924bc Merge "Remove ConnectivityManager and its usages from NetworkStatsService."
am: 93dfa10da4

Change-Id: I2a2809d3a2ee4106cc131d61ace401f31c187844
2019-02-28 19:18:33 -08:00
Varun Anand
5e980f4e3d Remove ConnectivityManager and its usages from NetworkStatsService.
NSS needed it for getting VpnInfo[], NetworkState[] and
activeLinkProperties which it used to query via ConnectivityManager.

For VpnInfo[], this was racy as NSS may ignore intermediate changes to a
VPN's underlying networks. See http://b/123961098 for more context.

It may also lead to deadlocks b/w ConnectivityService and
NetworkStatsService. See http://b/126245192 for more info.

This change will ensure that NSS is never contending on any of
ConnectivityService locks.

Bug: 123961098
Bug: 126245192
Bug: 120145746
Test: atest FrameworksNetTests
Change-Id: Id1da446b54d95ee68ed14079107b1a10318bcf8b
Merged-In: I57e117bb4e9efe491b19d6b5a479f2d58d1c58e6
2019-03-01 00:10:52 +00:00
Chiachang Wang
4bc3afb4c8 Merge "Fix broken javadoc links" am: e239dc818c
am: ba54027efe

Change-Id: I6423d51b19dd70a3e8a35841944d0c9c2a151768
2019-02-28 05:55:38 -08:00
Chiachang Wang
ba54027efe Merge "Fix broken javadoc links"
am: e239dc818c

Change-Id: I7f1ef96544450ae71af3b76783fcbdc7641a2d43
2019-02-28 05:46:29 -08:00
Treehugger Robot
e239dc818c Merge "Fix broken javadoc links" 2019-02-28 13:34:52 +00:00
Lorenzo Colitti
6c43228859 Merge changes from topic "nat64" am: cfb7f03ec9
am: e98fe61189

Change-Id: Iac01497eda611d334ee0ec2440f7d9f8bd27bd1f
2019-02-27 16:10:58 -08:00
Lorenzo Colitti
e98fe61189 Merge changes from topic "nat64"
am: cfb7f03ec9

Change-Id: I3f7f74c197dd5da3db7d8d41fa4a26aacf38c2e8
2019-02-27 15:56:18 -08:00
Lorenzo Colitti
cfb7f03ec9 Merge changes from topic "nat64"
* changes:
  Catch ServiceSpecificException instead of IllegalStateException.
  Manage NAT64 prefix discovery lifecycle in the framework.
  Track NAT64 in the framework and start clatd iff NAT64 detected
  Change Nat464Xlat lifecycle.
  Minor improvements to verifyTcpBufferSizeChange.
2019-02-27 23:37:42 +00:00
Jeff Vander Stoep
96c64edbd9 getConnectionOwnerUid: Clarify documentation
Test: build
Bug: 117573763
Change-Id: Ia899a541987b9c72a83287ed69fc47ab4d38f680
2019-02-27 13:37:37 -08:00
Lorenzo Colitti
7ec341ab58 Ensure handleUpdateLinkProperties runs on the CS handler thread.
In its own change for ease of rollbacks due to the risk of
possibly crashing existing codepaths.

Bug: 65674744
Test: atest FrameworksNetTests
Test: builds, boots. Wifi, cell data, private DNS work
Change-Id: I2c0acc1c7b8367803f17b4a12c1df0fdfbc29691
2019-02-27 18:21:22 +09:00
Lorenzo Colitti
b1ef6f7a8f 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
0d92d1a79c Fix broken javadoc links
Bug: 123683994
Test: Verify with javadoc
Change-Id: I4b1b936e3cf86104ace5fcb6829778710801f2d5
2019-02-27 17:18:40 +08:00
Lorenzo Colitti
714b786585 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
ac2d4841ca [automerger skipped] Merge "DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master" into stage-aosp-master
am: 5d53623a89 -s ours
am skip reason: subject contains skip directive

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

Change-Id: I6c115125bad894bbb597557f2e9c3de3eb2b95b5
2019-02-25 16:13:06 -08:00
Remi NGUYEN VAN
7bbea3f191 Merge "Add logging to NetworkStackClient" am: b4ef756571
am: 3c771cc3e6

Change-Id: Ib2f6bcda2429346d0418b460bc040fc5e9edbe97
2019-02-25 09:14:44 -08:00
Chenbo Feng
3549052c98 Merge "Send special permission information to netd" am: 84537c00b2
am: 26018a4836

Change-Id: I80271fa7c4e1c6a8e2eea55adf12abaece64d8da
2019-02-25 09:10:05 -08:00
Lorenzo Colitti
8d39bbf0a4 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
07f10206e6 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
b0e7a02891 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
5d53623a89 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
788b9131e3 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
2348103b5a 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
3c771cc3e6 Merge "Add logging to NetworkStackClient"
am: b4ef756571

Change-Id: I0fe820c6feab3caa9ad0739df100553b2d4374e0
2019-02-21 14:28:46 -08:00
Remi NGUYEN VAN
b4ef756571 Merge "Add logging to NetworkStackClient" 2019-02-21 22:13:31 +00:00
Chenbo Feng
26018a4836 Merge "Send special permission information to netd"
am: 84537c00b2

Change-Id: I35aa015a9448b5f8563da0aee40afd3101df29ff
2019-02-21 13:30:32 -08:00
Treehugger Robot
84537c00b2 Merge "Send special permission information to netd" 2019-02-21 20:27:58 +00:00
Remi NGUYEN VAN
a00a3f255d 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
002c556145 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
007d15e33d [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 273f900b3b is in history

Change-Id: I8cdd422bf5686c707d60137eccb4e1caae8194a3
2019-02-20 12:14:20 -08:00
Varun Anand
5ffc7e609f 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 273f900b3b)

Change-Id: Iae5f2024b19df04c31938815b52687781d016cde
Merged-In: Id0abc4d304bb096e92479a118168690ccce634ed
2019-02-20 18:37:44 +00:00
Xin Li
c859266980 [automerger skipped] Merge changes from topic "PPRL.190205.001" am: f6abf78795 -s ours
am: 0b448cafc4 -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
0b448cafc4 [automerger skipped] Merge changes from topic "PPRL.190205.001"
am: f6abf78795 -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