Commit Graph

1012 Commits

Author SHA1 Message Date
nharold
acdb1a217c Merge changes from topic 'ipsec-api-tweaks' am: fddf677b8b am: 176bfb58c6
am: a237a34085

Change-Id: Ie868985d20535f35b869730a4ddaa00dc88a352d
2017-04-12 20:53:17 +00:00
Nathan Harold
480aa304dd IpSecManager and IpSecAlgorithm API Tweaks am: 0540679eb4 am: 9c2428ad4d
am: 99c50add4f

Change-Id: I49641308cd0f2ce3e8a7545c8b03108d69287c64
2017-04-12 20:51:41 +00:00
Jack Yu
a49541d1c2 Merge changes into oc-dev-plus-aosp
am: a0afe2b4de

Change-Id: I53c193b28df6446580191ad6887768b80dfdd91c
2017-04-11 19:36:41 +00:00
Android Build Merger (Role)
a0afe2b4de Merge changes into oc-dev-plus-aosp 2017-04-11 19:22:17 +00:00
Nathan Harold
0072e19c8e Add FileDescriptor Versions of applyTransportModeTransform()
Because there is no way using the Java sockets API to actually
get a socket of AF_INET on mode machines, it is necessary to
provide a way to apply transforms to sockets made using the
native wrapper API, which uses POSIX APIs and will create a
socket that is AF_INET.

Bug: 36073210
Test: b/34811227
Change-Id: I28ac7cc4f36045ce523a54111e5be975b0331356
2017-04-11 10:14:11 -07:00
Nathan Harold
0540679eb4 IpSecManager and IpSecAlgorithm API Tweaks
-Add a reserveSecurityParamterIndex() function that allows the
 system to select an SPI.
-Disallow INVALID_SECURITY_PARAMETER_INDEX from being passed as
 an explicit SPI request.
-Remove the ALGO_ prefix from constants in IpSecAlgorithm

Bug: 36073210
Test: Updated CTS tests still pass on bullhead
Change-Id: Ic94809996076b0718f153f550b82192fe7048a2e
2017-04-11 10:14:10 -07:00
Hugo Benichi
28a4a50aad Merge changes I9ad4ce81,I360d539e am: f34d09ac30 am: 4062ac81be am: 84c878ecc8
am: 0a336978a8

Change-Id: I08ea5982d1f8f4d74bb37ad2409a1b7443bbb001
2017-04-06 02:57:00 +00:00
Nathan Harold
7c1acc7a6a Merge changes from topic 'ipsec-svc-pick' into oc-dev am: b077f6abd3 -s ours
am: d6b0f6e9f1

Change-Id: I9ed84510fdd92128bcd0a08b1dd90448e0ae09c1
2017-04-06 02:50:52 +00:00
Hugo Benichi
0a336978a8 Merge changes I9ad4ce81,I360d539e am: f34d09ac30 am: 4062ac81be
am: 84c878ecc8

Change-Id: Ieeb3222246c63292a75ad91e9c867eaedcad8f90
2017-04-06 02:13:07 +00:00
Nathan Harold
d6b0f6e9f1 Merge changes from topic 'ipsec-svc-pick' into oc-dev
am: b077f6abd3  -s ours

Change-Id: Iea4a23356643415390322a53a547f7194bb2cafa
2017-04-06 01:56:16 +00:00
Treehugger Robot
f34d09ac30 Merge changes I9ad4ce81,I360d539e
* changes:
  NsdService: minor cleanups
  Nsdmanager/NsdService: add logging
2017-04-06 01:51:36 +00:00
Nathan Harold
7c30d6b8f2 Add Initial IPsec APIs to IpSecService
-Plumb IpSecManager APIs to NetD
-Add Resource Management to IpSecService

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: Ic43965c6158f28cac53810adbf5cf50d2c54f920
(cherry picked from commit 93962f34ce21f5aac825afbcebf2f3e8c7a30910)
2017-04-05 10:24:45 -07:00
Nathan Harold
8e518b4255 IpSecManager and IpSecTransform API Cleanup
-Remove Int-based SPI usage from the IpSecTransform.Builder
 This is essentially a less-safe method overload, and it is both
 unnecessary and difficult to implement: the cross-validation
 between SPI and Transform is actually useful, and the kernel
 requires two different mechanisms to use an unreserved vs a
 reserved (alloc'd) SPI: CREATESA vs UPDATESA, which makes this
 hard to support. API Council has questioned the value of this,
 and they are right: everything points to "remove this". In the
 future, if we find that SPI reservation is overhead, we can
 always add it back.

-Hiding the TunnelMode builder method and application/remove
 methods. These will not land by the time the next API
 stabilizes, so better to hide them now that this is a
 near-certainty. Expectation is to un-hide them in the subsequent
 API bump.

Bug: 36073210
Test: Compilation, verified nobody is calling these stubs
Change-Id: Ic1a3f2cf7128633318ac175d6b56b45eb8d21cab
(cherry picked from commit 48b566557d5a66d4476008b3c59b815eb78cb373)
2017-04-05 10:24:23 -07:00
Nathan Harold
18fd608286 Change reserveSecurityParameterIndex() to take a remoteAddress
To make the SPI reservation more semantically consistent with the
transform creation API, and to ensure that we always create SPI
reservations relative to a well-known remote, we should take the
SPI request relative to a remote (rather than to a destination).
This necessitates that we now consider direction separately, which
is used for keying the SA-Id.

Bug: 36073210
Test: compilation
Change-Id: I81e955c20128c1f8e04fd68eb26669561f827a78
(cherry picked from commit c4f879925b58b1b5ca9a3cfdc898c20cbf56355a)
2017-04-05 10:24:03 -07:00
Nathan Harold
8ea66052f2 Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
(cherry picked from commit 28084d89ec136b56f5012be33a0dea147962f9f6)
2017-04-05 10:23:27 -07:00
Hugo Benichi
f0c840913d NsdService: minor cleanups
Minor cleanups in switches of processMessage and handleNativeEvent.

Test: no functional changes
Bug: 33074219
Change-Id: I9ad4ce812c0d2c02a671a7a871ad427e4ce29b4a
2017-04-05 15:05:49 +09:00
Hugo Benichi
32be63d083 Nsdmanager/NsdService: add logging
This patch adds basic logging to NsdManager and NsdService, and improves
the facilities for pretty printing the event ids defined in NsdManager.

It also includes a few minor cleanups:
  - adding 'final' on effectively final instance variables of NsdManager
  and NsdService.
  - similarly, adding 'static' on effectively static class fields.
  - regrouping instance variables together.

Test: no functional changes
Bug: 33074219
Change-Id: I360d539e73cc8e4b45d4e0d20b2e345455fdb10c
2017-04-05 15:05:44 +09:00
Jeff Sharkey
9037a1de1e Consistent dump() permission checking. am: f1077c3095
am: ad0842183c

Change-Id: Iffbf78a7b48cea41ed4b0763f2452738e084225c
2017-04-03 06:26:04 +00:00
Jeff Sharkey
ad0842183c Consistent dump() permission checking.
am: f1077c3095

Change-Id: I300f8bc07e1266b9e78f56d085cd458862176a85
2017-04-03 06:19:02 +00:00
Jeff Sharkey
f1077c3095 Consistent dump() permission checking.
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access.  It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
2017-04-02 22:29:07 -06:00
nharold
f859d7e2a2 Merge changes from topic 'ipsec-transport-impl' am: 464dc5c07e am: 38e47af3ef am: 8108bef16d
am: 6ca64c9dbe

Change-Id: I4fdc0e7f211f637b00ec9ecd438a7a528aec001f
2017-04-02 00:44:13 +00:00
Nathan Harold
9c765a6866 IpSecManager and IpSecTransform API Cleanup am: 55e8910aa8 am: 91b516e78b am: 37f260f5d8
am: 426d6f088f

Change-Id: I3ab5922127950cc6bca042d6ab43fb10a5b83431
2017-04-02 00:43:05 +00:00
nharold
6ca64c9dbe Merge changes from topic 'ipsec-transport-impl' am: 464dc5c07e am: 38e47af3ef
am: 8108bef16d

Change-Id: Ie820478fc01f42b5143a63a3422380ce7ec74847
2017-04-02 00:35:08 +00:00
Nathan Harold
426d6f088f IpSecManager and IpSecTransform API Cleanup am: 55e8910aa8 am: 91b516e78b
am: 37f260f5d8

Change-Id: Ie84a720356466000930030de6f7a9182500afadb
2017-04-02 00:33:17 +00:00
nharold
38e47af3ef Merge changes from topic 'ipsec-transport-impl'
am: 464dc5c07e

Change-Id: I6caf23f5fef995f1ad735ea64b99660a5180799f
2017-04-02 00:19:44 +00:00
Nathan Harold
91b516e78b IpSecManager and IpSecTransform API Cleanup
am: 55e8910aa8

Change-Id: I1524f8381c8a73ba4dc7a36b343e11066b75c08d
2017-04-02 00:18:42 +00:00
Nathan Harold
031acb850f Add Initial IPsec APIs to IpSecService
-Plumb IpSecManager APIs to NetD
-Add Resource Management to IpSecService

Bug: 33695893
Test: CTS verifies nearly all of these paths
Change-Id: Ic43965c6158f28cac53810adbf5cf50d2c54f920
2017-03-31 18:11:27 -07:00
Nathan Harold
55e8910aa8 IpSecManager and IpSecTransform API Cleanup
-Remove Int-based SPI usage from the IpSecTransform.Builder
 This is essentially a less-safe method overload, and it is both
 unnecessary and difficult to implement: the cross-validation
 between SPI and Transform is actually useful, and the kernel
 requires two different mechanisms to use an unreserved vs a
 reserved (alloc'd) SPI: CREATESA vs UPDATESA, which makes this
 hard to support. API Council has questioned the value of this,
 and they are right: everything points to "remove this". In the
 future, if we find that SPI reservation is overhead, we can
 always add it back.

-Hiding the TunnelMode builder method and application/remove
 methods. These will not land by the time the next API
 stabilizes, so better to hide them now that this is a
 near-certainty. Expectation is to un-hide them in the subsequent
 API bump.

Bug: 36073210
Test: Compilation, verified nobody is calling these stubs
Change-Id: Ic1a3f2cf7128633318ac175d6b56b45eb8d21cab
2017-03-31 11:21:10 -07:00
Nathan Harold
e91cac67c8 Merge "Change reserveSecurityParameterIndex() to take a remoteAddress" am: d118826971 am: d083810c0b am: 81d48a99e0
am: abf3bde466

Change-Id: I86d5e1c019336707f7d3f1102aaca52a91dea310
2017-03-30 03:51:47 +00:00
Nathan Harold
abf3bde466 Merge "Change reserveSecurityParameterIndex() to take a remoteAddress" am: d118826971 am: d083810c0b
am: 81d48a99e0

Change-Id: I941ee00099df0afdbce94b73c1bd81c246fac1e8
2017-03-30 03:48:20 +00:00
Nathan Harold
d083810c0b Merge "Change reserveSecurityParameterIndex() to take a remoteAddress"
am: d118826971

Change-Id: Ie59322c4e80aab89d784a2fcb3edd6458677bbb7
2017-03-30 03:39:46 +00:00
Nathan Harold
909d66e80a Change reserveSecurityParameterIndex() to take a remoteAddress
To make the SPI reservation more semantically consistent with the
transform creation API, and to ensure that we always create SPI
reservations relative to a well-known remote, we should take the
SPI request relative to a remote (rather than to a destination).
This necessitates that we now consider direction separately, which
is used for keying the SA-Id.

Bug: 36073210
Test: compilation
Change-Id: I81e955c20128c1f8e04fd68eb26669561f827a78
2017-03-29 17:46:47 -07:00
Nathan Harold
49046bbc73 Merge commit 'e45e328821ba' into oc-dev-plus-aosp
am: 7e854f1b82

Change-Id: I136c31aa5b27a3520c93141d91d6198e2dae3a1d
2017-03-30 00:15:17 +00:00
Nathan Harold
7e854f1b82 Merge commit 'e45e328821ba' into oc-dev-plus-aosp
Change-Id: I30ad9038be8faee57e5d6b1391d9e70a966a9a77
2017-03-29 17:05:10 -07:00
Nathan Harold
caf765db81 Merge commit 'ce073d70bedc' into stage-aosp-master
Change-Id: I319034a5b77de5cf71de0e110bb17819fb907f1b
2017-03-29 16:04:31 -07:00
Nathan Harold
927e040ae3 Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 34811227
Test: Service boots (and dumpsys works), more via b/34811227
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
2017-03-29 11:38:20 -07:00
Nathan Harold
d2a1dad9a8 Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 34811227
Test: Service boots (and dumpsys works), more via b/34811227
Merged-In: I4cdcb643421141202f77a0e2f87a37012de0cd92
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
2017-03-29 11:31:27 -07:00
Ryuki Nakamura
f8dd5d479a Merge "Fix NPE while performing NetworkStatsService.removeUidsLocked()" am: a6ce3f3021 am: 8d2a076b4e
am: 06659047f0

Change-Id: Ia7c8309f68d85a88e2a26169509d3e45d4d2ff69
2017-03-20 17:24:37 +00:00
Ryuki Nakamura
8d2a076b4e Merge "Fix NPE while performing NetworkStatsService.removeUidsLocked()"
am: a6ce3f3021

Change-Id: I3f43b25622e5052e6336983da84b92e12f3e06dc
2017-03-20 17:05:16 +00:00
Ryuki Nakamura
662a01236a Fix NPE while performing NetworkStatsService.removeUidsLocked()
Symptom:
NPE occurred while performing NetworkStatsService.removeUidsLocked().

Root cause:
NetworkStatsService refers to mUidRecorder at
NetworkStatsService.removeUidsLocked() when mUserReceiver received
Intent.ACTION_USER_REMOVED.
However NetworkStatsService sets mUidRecorder to null without
unregistering mUserReceiver when mShutdownReceiver received
Intent.ACTION_SHUTDOWN.
Therefore NPE occurred when mUserReceiver received
Intent.ACTION_USER_REMOVED after mShutdownReceiver received
Intent.ACTION_SHUTDOWN.

Solution:
Unregister mUserReceiver before setting mUidRecorder to null when
mShutdownReceiver received Intent.ACTION_SHUTDOWN.

Bug: 36015339

Change-Id: I9279e4c6ae07d94e7ec519c40b2d973c84d8fef1
2017-03-07 07:12:51 +00:00
Nathan Harold
fab5eff9a6 Merge "Add API Surface for creating IpSec Transforms" am: 7645fa2816 am: 5466fbdc27
am: 3ddaf3e6b0

Change-Id: Idceae0e5a1af2f357378b03fc0d257dab605b217
2017-03-01 14:22:57 +00:00
Nathan Harold
5466fbdc27 Merge "Add API Surface for creating IpSec Transforms"
am: 7645fa2816

Change-Id: Ibe70a60c5c5808a7877145cccefcc1f11bfacc51
2017-03-01 14:12:55 +00:00
Nathan Harold
b1f605fc33 Add API Surface for creating IpSec Transforms
This CL adds an API to set up an IPSec Security Association
and Security Policy to perform Transport-Mode and Tunnel-Mode encapuslation
of IP Packets.

Bug: 30984788
Bug: 34811752
Test: 34812052, 34811227
Change-Id: Ic9f63c7bb366302a24baa3e1b79020210910ac0a
2017-02-28 22:01:20 -08:00
Stephen Chen
a86d26ef4b Merge commit '29a9cf2250e0eaed062fd0f990a04b923896279b' into nyc-mr1-dev-plus-aosp am: 8aa88a533c
am: 30fb2f228b

Change-Id: I318efe59e1967150338a7bd8001c27d9ebe3cf75
2017-01-27 07:42:07 +00:00
Hugo Benichi
7ee689b582 Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp am: cf7d2e1221 -s ours
am: d44a2395e3

Change-Id: I7028ef23f597e6e82ecdb6c11a6c8dcdb1d1f77b
2017-01-27 07:40:56 +00:00
Stephen Chen
30fb2f228b Merge commit '29a9cf2250e0eaed062fd0f990a04b923896279b' into nyc-mr1-dev-plus-aosp
am: 8aa88a533c

Change-Id: I3de8f91b1c9d0160ec58be8347502769580e0159
2017-01-27 07:29:07 +00:00
Hugo Benichi
d44a2395e3 Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
am: cf7d2e1221  -s ours

Change-Id: Ie2f8c1e18acf57238fe4816812562ecd1644cf51
2017-01-27 07:28:06 +00:00
The Android Automerger
8aa88a533c Merge commit '29a9cf2250e0eaed062fd0f990a04b923896279b' into nyc-mr1-dev-plus-aosp
* commit '29a9cf2250e0eaed062fd0f990a04b923896279b':
  Implement metered tracking for NetworkStats summary queries.
2017-01-27 06:39:41 +00:00
The Android Automerger
cf7d2e1221 Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
* commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1': (35 commits)
  NetworkMonitor: send one DNS probe per web probe
  NetworkMonitor metrics: add first validation information
  APF: also drop any ICMPv6 RSs
  ConnectivityServiceTest: fix testAvoidBadWifiSettings
  Fix ConnectivityServiceTest testRequestBenchmark
  Switch over to new "time.android.com" NTP pool.
  Define API for metering network stats buckets.
  Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  Use @Ignore to explicitly disable a @Test method.
  Fixed NetworkStatsServiceTest and converted it to JUnit4.
  VPN network stat accounting changes.
  ConnectivityThread: use lazy holder idiom
  ConnectivityManager: use ConnectivityThread looper
  ConnectivityManager: a simpler CallbackHandler
  Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  Add a null check for the OnStartTetheringCallback.
  TokenBucket for rate-limiting and throttling
  IpConnectivityMetrics reads buffer size in settings
  CaptivePortalLogin: set mixed content policy to compatibility.
  Add IP conn metrics to dumpsys and bug reports
  ...
2017-01-27 06:39:05 +00:00
Stephen Chen
29a9cf2250 Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 357f8fabc8)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2017-01-26 18:52:32 +09:00